fix: initialization order for error reporting and ensure zero-initialized buffers#11
fix: initialization order for error reporting and ensure zero-initialized buffers#11sachintu47 wants to merge 2 commits into
Conversation
🤖 Augment PR SummarySummary: Moves 🤖 Was this summary useful? React with 👍 or 👎 |
| dfile->msgbufflen = DIO_MSG_BUFF_LEN; | ||
| dfile->logstream = logstream; | ||
| dfile->opts = calloc(1, sizeof(DBG_Opts)); | ||
| init_opts(dfile->opts, dfile); |
There was a problem hiding this comment.
init_opts() snapshots dfile->debug into opts->debug, but LIBDIO_DEBUG is applied later, so opts->debug can stay disabled even when debugging is enabled. That can make any DBG_Opts-controlled debug output inconsistent with dfile->debug.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
augment review |
| dfile->msgbufflen = DIO_MSG_BUFF_LEN; | ||
| dfile->logstream = logstream; | ||
| dfile->opts = calloc(1, sizeof(DBG_Opts)); | ||
| init_opts(dfile->opts, dfile); |
There was a problem hiding this comment.
dfile->opts is allocated with calloc() but not checked before calling init_opts(), so an OOM here could lead to a NULL dereference inside init_opts. Consider handling dfile->opts == NULL similarly to the other allocation-failure paths in open_dataset().
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
fix: initialization order for error reporting and ensure zero-initialized buffers