Commit 148e1926 authored by Alexander Alashkin's avatar Alexander Alashkin Committed by rojer

Fix crash in c_vsnprintf

    PUBLISHED_FROM=020d1b9ea66862f71b08232b827cdd6e97528765
parent 96c023df
......@@ -1773,10 +1773,13 @@ int c_vsnprintf(char *buf, size_t buf_size, const char *fmt, va_list ap) {
C_SNPRINTF_APPEND_CHAR(' ');
}
/* `s` may be NULL in case of %.*s */
if (s != NULL) {
/* Ignore negative and 0 precisions */
for (j = 0; (precision <= 0 || j < precision) && s[j] != '\0'; j++) {
C_SNPRINTF_APPEND_CHAR(s[j]);
}
}
} else if (ch == 'c') {
ch = va_arg(ap, int); /* Always fetch parameter */
C_SNPRINTF_APPEND_CHAR(ch);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment