< prev index next >
src/hotspot/share/prims/jvm.cpp
Print this page
@@ -2717,14 +2717,14 @@
ATTRIBUTE_PRINTF(3, 0)
int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
// Reject count values that are negative signed values converted to
// unsigned; see bug 4399518, 4417214
- if ((intptr_t)count <= 0) return -1;
+ if ((intptr_t)count < 0) return -1;
int result = os::vsnprintf(str, count, fmt, args);
- if (result > 0 && (size_t)result >= count) {
+ if (count > 0 && result > 0 && (size_t)result >= count) {
result = -1;
}
return result;
}
< prev index next >