Logging a NULL pointer instead of passing it in the memcpy().
This commit is contained in:
@@ -115,6 +115,7 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
|
|||||||
static const u_char hexadecimal[16] = "0123456789abcdef";
|
static const u_char hexadecimal[16] = "0123456789abcdef";
|
||||||
static const u_char HEXADECIMAL[16] = "0123456789ABCDEF";
|
static const u_char HEXADECIMAL[16] = "0123456789ABCDEF";
|
||||||
static const u_char nan[] = "[nan]";
|
static const u_char nan[] = "[nan]";
|
||||||
|
static const u_char null[] = "[null]";
|
||||||
static const u_char infinity[] = "[infinity]";
|
static const u_char infinity[] = "[infinity]";
|
||||||
|
|
||||||
spf.end = end;
|
spf.end = end;
|
||||||
@@ -150,15 +151,18 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
|
fmt++;
|
||||||
|
|
||||||
p = va_arg(args, const u_char *);
|
p = va_arg(args, const u_char *);
|
||||||
|
|
||||||
if (nxt_fast_path(p != NULL)) {
|
if (nxt_slow_path(p == NULL)) {
|
||||||
|
goto copy;
|
||||||
|
}
|
||||||
|
|
||||||
while (*p != '\0' && buf < end) {
|
while (*p != '\0' && buf < end) {
|
||||||
*buf++ = *p++;
|
*buf++ = *p++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fmt++;
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case '*':
|
case '*':
|
||||||
@@ -170,10 +174,8 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
|
|||||||
fmt++;
|
fmt++;
|
||||||
p = va_arg(args, const u_char *);
|
p = va_arg(args, const u_char *);
|
||||||
|
|
||||||
if (nxt_fast_path(p != NULL)) {
|
|
||||||
goto copy;
|
goto copy;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -554,7 +556,15 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
|
|||||||
|
|
||||||
copy:
|
copy:
|
||||||
|
|
||||||
buf = nxt_cpymem(buf, p, nxt_min((size_t) (end - buf), length));
|
if (nxt_slow_path(p == NULL)) {
|
||||||
|
p = null;
|
||||||
|
length = nxt_length(null);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
length = nxt_min((size_t) (end - buf), length);
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = nxt_cpymem(buf, p, length);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user