Skip to content

Commit 9328407

Browse files
committed
lib: add extra nullptr check to get_freebusy
``` (gdb) bt f0 TPROPVAL_ARRAY::find (tag=0x80030102, this=0x0) at include/gromox/mapidefs.h:1198 f1 TPROPVAL_ARRAY::getval (this=0x0, tag=0x80030102) at include/gromox/mapidefs.h:1211 f2 TPROPVAL_ARRAY::get<BINARY> (tag=<optimized out>, this=<optimized out>) at include/gromox/mapidefs.h:1219 f3 get_freebusy (username=username@entry=0x7f8610410f34 "[email protected]", dir=<optimized out>, dir@entry=0x7f85e0a8b790 "/var/lib/gromox/user/A/1", start_time=start_time@entry=1758852000, end_time=end_time@entry=1761271200, fb_data=std::vector of length 210, capacity 256 = {...}) at lib/freebusy.cpp:418 418 if (!goid_to_icaluid(ctnt->proplist.get<BINARY>(ptag.globalobjectid), uid_buf)) (gdb) p ctnt $2 = (message_content *) 0x0 ``` This should not be happening; might be caused by a different bug. References: GXL-503, DESK-3987
1 parent e7b676b commit 9328407

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/freebusy.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ bool get_freebusy(const char *username, const char *dir, time_t start_time,
418418
for (size_t i = 0; i < rows.count; ++i) {
419419
message_content *ctnt = nullptr;
420420
auto msgid = rows.pparray[i]->get<const uint64_t>(PidTagMid);
421-
if (msgid == nullptr)
422-
continue;
423-
if (!exmdb_client->read_message(dir, nullptr, CP_ACP, *msgid, &ctnt))
421+
if (msgid == nullptr ||
422+
!exmdb_client->read_message(dir, nullptr, CP_ACP, *msgid, &ctnt) ||
423+
ctnt == nullptr)
424424
continue;
425425
std::string uid_buf;
426426
if (!goid_to_icaluid(ctnt->proplist.get<BINARY>(ptag.globalobjectid), uid_buf))

0 commit comments

Comments
 (0)