|
|
@ -2138,7 +2138,7 @@ void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level, |
|
|
|
"libusbx: %s [%s] ", prefix, function); |
|
|
|
"libusbx: %s [%s] ", prefix, function); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (header_len < 0 || header_len >= sizeof(buf)) { |
|
|
|
if (header_len < 0 || (size_t)header_len >= sizeof(buf)) { |
|
|
|
/* Somehow snprintf failed to write to the buffer,
|
|
|
|
/* Somehow snprintf failed to write to the buffer,
|
|
|
|
* remove the header so something useful is output. */ |
|
|
|
* remove the header so something useful is output. */ |
|
|
|
header_len = 0; |
|
|
|
header_len = 0; |
|
|
@ -2147,7 +2147,7 @@ void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level, |
|
|
|
buf[header_len] = '\0'; |
|
|
|
buf[header_len] = '\0'; |
|
|
|
text_len = vsnprintf(buf + header_len, sizeof(buf) - header_len, |
|
|
|
text_len = vsnprintf(buf + header_len, sizeof(buf) - header_len, |
|
|
|
format, args); |
|
|
|
format, args); |
|
|
|
if (text_len < 0 || text_len + header_len >= sizeof(buf)) { |
|
|
|
if (text_len < 0 || text_len + (size_t)header_len >= sizeof(buf)) { |
|
|
|
/* Truncated log output. On some platforms a -1 return value means
|
|
|
|
/* Truncated log output. On some platforms a -1 return value means
|
|
|
|
* that the output was truncated. */ |
|
|
|
* that the output was truncated. */ |
|
|
|
text_len = sizeof(buf) - header_len; |
|
|
|
text_len = sizeof(buf) - header_len; |
|
|
|