8076475: Misuses of strncpy/strncat

Various small fixes around strncpy and strncat

Reviewed-by: dsamersoff, coleenp
This commit is contained in:
Thomas Stuefe 2015-04-07 14:19:03 +02:00
parent 137a04308f
commit c034b74806
12 changed files with 56 additions and 52 deletions

View file

@ -463,14 +463,7 @@ void VMError::report(outputStream* st) {
#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);
st->print(" (%s:%d)", file, _lineno);
} else {
st->print(" (0x%x)", _id);
}