< prev index next >
src/share/vm/compiler/compileBroker.hpp
Print this page
rev 8113 : 8076475: Misuses of strncpy/strncat
Summary: Various small fixes around strncpy and strncat
Reviewed-by: dsamersoff
@@ -170,11 +170,12 @@
CompilerCounters(const char* name, int instance, TRAPS);
// these methods should be called in a thread safe context
void set_current_method(const char* method) {
- strncpy(_current_method, method, (size_t)cmname_buffer_length);
+ strncpy(_current_method, method, (size_t)cmname_buffer_length-1);
+ _current_method[cmname_buffer_length-1] = '\0';
if (UsePerfData) _perf_current_method->set_value(method);
}
char* current_method() { return _current_method; }
< prev index next >