Correct WHOX overflow check so it also works for fields other than the last.
Found with llvm static analyzer.
This commit is contained in:
parent
a6210c453a
commit
8fc0a9b621
|
@ -442,7 +442,7 @@ append_format(char *buf, size_t bufsize, size_t *pos, const char *fmt, ...)
|
||||||
|
|
||||||
max = *pos >= bufsize ? 0 : bufsize - *pos;
|
max = *pos >= bufsize ? 0 : bufsize - *pos;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
result = rb_vsnprintf(buf + *pos, bufsize - *pos, fmt, ap);
|
result = rb_vsnprintf(buf + *pos, max, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
*pos += result;
|
*pos += result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue