< prev index next >

src/share/vm/utilities/vmError.cpp

Print this page
rev 8113 : 8076475: Misuses of strncpy/strncat
Summary: Various small fixes around strncpy and strncat
Reviewed-by: dsamersoff

*** 461,478 **** const char *p = strrchr(_filename, separator); const char *file = p ? p+1 : _filename; #else const char *file = _filename; #endif ! size_t len = strlen(file); ! size_t buflen = sizeof(buf); ! ! strncpy(buf, file, buflen); ! if (len + 10 < buflen) { ! sprintf(buf + len, ":%d", _lineno); ! } ! st->print(" (%s)", buf); } else { st->print(" (0x%x)", _id); } } --- 461,471 ---- const char *p = strrchr(_filename, separator); const char *file = p ? p+1 : _filename; #else const char *file = _filename; #endif ! st->print(" (%s:%d)", file, _lineno); } else { st->print(" (0x%x)", _id); } }
< prev index next >