mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Fix coverity defects: CID 147587
CID 147587: Out-of-bounds read Future changes may cause an array overrun of 4096 bytes at byte offset 4096 by dereferencing pointer dstp. Adding this additional check ensures correctness. Reviewed-by: Chunwei Chen <david.chen@osnexus.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: GeLiXin <ge.lixin@zte.com.cn> Closes #5297
This commit is contained in:
parent
53ed2db212
commit
547c593661
@ -264,6 +264,13 @@ _zed_event_add_var(uint64_t eid, zed_strings_t *zsp,
|
||||
*dstp++ = '=';
|
||||
buflen--;
|
||||
|
||||
if (buflen <= 0) {
|
||||
errno = EMSGSIZE;
|
||||
zed_log_msg(LOG_WARNING, "Failed to add %s for eid=%llu: %s",
|
||||
keybuf, eid, "Exceeded buffer size");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
va_start(vargs, fmt);
|
||||
n = vsnprintf(dstp, buflen, fmt, vargs);
|
||||
va_end(vargs);
|
||||
|
Loading…
Reference in New Issue
Block a user