8299635: Hotspot update for deprecated sprintf in Xcode 14
Reviewed-by: dholmes, mikael
This commit is contained in:
parent
f279c751a5
commit
e80b5ea448
@ -257,7 +257,7 @@ uint MachConstantBaseNode::size(PhaseRegAlloc*) const {
|
||||
#ifndef PRODUCT
|
||||
void MachConstantBaseNode::format(PhaseRegAlloc* ra_, outputStream* st) const {
|
||||
char reg[128];
|
||||
ra_->dump_register(this, reg);
|
||||
ra_->dump_register(this, reg, sizeof(reg));
|
||||
st->print("MOV_SLOW &constanttable,%s\t! constant table base", reg);
|
||||
}
|
||||
#endif
|
||||
|
@ -1944,7 +1944,7 @@ uint MachNopNode::size(PhaseRegAlloc *ra_) const {
|
||||
void BoxLockNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
|
||||
int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
|
||||
char reg_str[128];
|
||||
ra_->dump_register(this, reg_str);
|
||||
ra_->dump_register(this, reg_str, sizeof(reg_str));
|
||||
st->print("ADDI %s, SP, %d \t// box node", reg_str, offset);
|
||||
}
|
||||
#endif
|
||||
|
@ -267,7 +267,7 @@ int AixAttachListener::init() {
|
||||
//
|
||||
AixAttachOperation* AixAttachListener::read_request(int s) {
|
||||
char ver_str[8];
|
||||
sprintf(ver_str, "%d", ATTACH_PROTOCOL_VER);
|
||||
os::snprintf_checked(ver_str, sizeof(ver_str), "%d", ATTACH_PROTOCOL_VER);
|
||||
|
||||
// The request is a sequence of strings so we first figure out the
|
||||
// expected count and the maximum possible length of the request.
|
||||
@ -312,7 +312,7 @@ AixAttachOperation* AixAttachListener::read_request(int s) {
|
||||
if ((strlen(buf) != strlen(ver_str)) ||
|
||||
(atoi(buf) != ATTACH_PROTOCOL_VER)) {
|
||||
char msg[32];
|
||||
sprintf(msg, "%d\n", ATTACH_ERROR_BADVERSION);
|
||||
os::snprintf_checked(msg, sizeof(msg), "%d\n", ATTACH_ERROR_BADVERSION);
|
||||
write_fully(s, msg, strlen(msg));
|
||||
return NULL;
|
||||
}
|
||||
@ -442,7 +442,7 @@ void AixAttachOperation::complete(jint result, bufferedStream* st) {
|
||||
|
||||
// write operation result
|
||||
char msg[32];
|
||||
sprintf(msg, "%d\n", result);
|
||||
os::snprintf_checked(msg, sizeof(msg), "%d\n", result);
|
||||
int rc = AixAttachListener::write_fully(this->socket(), msg, strlen(msg));
|
||||
|
||||
// write any result data
|
||||
@ -545,7 +545,7 @@ bool AttachListener::is_init_trigger() {
|
||||
char fn[PATH_MAX + 1];
|
||||
int ret;
|
||||
struct stat64 st;
|
||||
sprintf(fn, ".attach_pid%d", os::current_process_id());
|
||||
os::snprintf_checked(fn, sizeof(fn), ".attach_pid%d", os::current_process_id());
|
||||
RESTARTABLE(::stat64(fn, &st), ret);
|
||||
if (ret == -1) {
|
||||
log_trace(attach)("Failed to find attach file: %s, trying alternate", fn);
|
||||
|
@ -523,7 +523,7 @@ void os::init_system_properties_values() {
|
||||
#endif
|
||||
#define EXTENSIONS_DIR "/lib/ext"
|
||||
|
||||
// Buffer that fits several sprintfs.
|
||||
// Buffer that fits several snprintfs.
|
||||
// Note that the space for the trailing null is provided
|
||||
// by the nulls included by the sizeof operator.
|
||||
const size_t bufsize =
|
||||
@ -571,13 +571,14 @@ void os::init_system_properties_values() {
|
||||
|
||||
// Concatenate user and invariant part of ld_library_path.
|
||||
// That's +1 for the colon and +1 for the trailing '\0'.
|
||||
char *ld_library_path = NEW_C_HEAP_ARRAY(char, strlen(v) + 1 + sizeof(DEFAULT_LIBPATH) + 1, mtInternal);
|
||||
sprintf(ld_library_path, "%s%s" DEFAULT_LIBPATH, v, v_colon);
|
||||
size_t pathsize = strlen(v) + 1 + sizeof(DEFAULT_LIBPATH) + 1;
|
||||
char *ld_library_path = NEW_C_HEAP_ARRAY(char, pathsize, mtInternal);
|
||||
os::snprintf_checked(ld_library_path, pathsize, "%s%s" DEFAULT_LIBPATH, v, v_colon);
|
||||
Arguments::set_library_path(ld_library_path);
|
||||
FREE_C_HEAP_ARRAY(char, ld_library_path);
|
||||
|
||||
// Extensions directories.
|
||||
sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
|
||||
os::snprintf_checked(buf, bufsize, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
|
||||
Arguments::set_ext_dirs(buf);
|
||||
|
||||
FREE_C_HEAP_ARRAY(char, buf);
|
||||
|
@ -248,7 +248,7 @@ int LinuxAttachListener::init() {
|
||||
//
|
||||
LinuxAttachOperation* LinuxAttachListener::read_request(int s) {
|
||||
char ver_str[8];
|
||||
sprintf(ver_str, "%d", ATTACH_PROTOCOL_VER);
|
||||
os::snprintf_checked(ver_str, sizeof(ver_str), "%d", ATTACH_PROTOCOL_VER);
|
||||
|
||||
// The request is a sequence of strings so we first figure out the
|
||||
// expected count and the maximum possible length of the request.
|
||||
@ -291,7 +291,7 @@ LinuxAttachOperation* LinuxAttachListener::read_request(int s) {
|
||||
if ((strlen(buf) != strlen(ver_str)) ||
|
||||
(atoi(buf) != ATTACH_PROTOCOL_VER)) {
|
||||
char msg[32];
|
||||
sprintf(msg, "%d\n", ATTACH_ERROR_BADVERSION);
|
||||
os::snprintf_checked(msg, sizeof(msg), "%d\n", ATTACH_ERROR_BADVERSION);
|
||||
write_fully(s, msg, strlen(msg));
|
||||
return NULL;
|
||||
}
|
||||
@ -411,7 +411,7 @@ void LinuxAttachOperation::complete(jint result, bufferedStream* st) {
|
||||
|
||||
// write operation result
|
||||
char msg[32];
|
||||
sprintf(msg, "%d\n", result);
|
||||
os::snprintf_checked(msg, sizeof(msg), "%d\n", result);
|
||||
int rc = LinuxAttachListener::write_fully(this->socket(), msg, strlen(msg));
|
||||
|
||||
// write any result data
|
||||
@ -513,7 +513,7 @@ bool AttachListener::is_init_trigger() {
|
||||
char fn[PATH_MAX + 1];
|
||||
int ret;
|
||||
struct stat64 st;
|
||||
sprintf(fn, ".attach_pid%d", os::current_process_id());
|
||||
os::snprintf_checked(fn, sizeof(fn), ".attach_pid%d", os::current_process_id());
|
||||
RESTARTABLE(::stat64(fn, &st), ret);
|
||||
if (ret == -1) {
|
||||
log_trace(attach)("Failed to find attach file: %s, trying alternate", fn);
|
||||
|
@ -444,7 +444,7 @@ void os::init_system_properties_values() {
|
||||
#define SYS_EXT_DIR "/usr/java/packages"
|
||||
#define EXTENSIONS_DIR "/lib/ext"
|
||||
|
||||
// Buffer that fits several sprintfs.
|
||||
// Buffer that fits several snprintfs.
|
||||
// Note that the space for the colon and the trailing null are provided
|
||||
// by the nulls included by the sizeof operator.
|
||||
const size_t bufsize =
|
||||
@ -499,17 +499,15 @@ void os::init_system_properties_values() {
|
||||
const char *v_colon = ":";
|
||||
if (v == NULL) { v = ""; v_colon = ""; }
|
||||
// That's +1 for the colon and +1 for the trailing '\0'.
|
||||
char *ld_library_path = NEW_C_HEAP_ARRAY(char,
|
||||
strlen(v) + 1 +
|
||||
sizeof(SYS_EXT_DIR) + sizeof("/lib/") + sizeof(DEFAULT_LIBPATH) + 1,
|
||||
mtInternal);
|
||||
sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib:" DEFAULT_LIBPATH, v, v_colon);
|
||||
size_t pathsize = strlen(v) + 1 + sizeof(SYS_EXT_DIR) + sizeof("/lib/") + sizeof(DEFAULT_LIBPATH) + 1;
|
||||
char *ld_library_path = NEW_C_HEAP_ARRAY(char, pathsize, mtInternal);
|
||||
os::snprintf_checked(ld_library_path, pathsize, "%s%s" SYS_EXT_DIR "/lib:" DEFAULT_LIBPATH, v, v_colon);
|
||||
Arguments::set_library_path(ld_library_path);
|
||||
FREE_C_HEAP_ARRAY(char, ld_library_path);
|
||||
}
|
||||
|
||||
// Extensions directories.
|
||||
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
|
||||
os::snprintf_checked(buf, bufsize, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
|
||||
Arguments::set_ext_dirs(buf);
|
||||
|
||||
FREE_C_HEAP_ARRAY(char, buf);
|
||||
|
@ -382,8 +382,9 @@ void os::init_system_properties_values() {
|
||||
char path[MAX_PATH];
|
||||
char buf[2 * MAX_PATH + 2 * sizeof(EXT_DIR) + sizeof(PACKAGE_DIR) + 1];
|
||||
GetWindowsDirectory(path, MAX_PATH);
|
||||
sprintf(buf, "%s%s;%s%s%s", Arguments::get_java_home(), EXT_DIR,
|
||||
path, PACKAGE_DIR, EXT_DIR);
|
||||
os::snprintf_checked(buf, sizeof(buf), "%s%s;%s%s%s",
|
||||
Arguments::get_java_home(), EXT_DIR,
|
||||
path, PACKAGE_DIR, EXT_DIR);
|
||||
Arguments::set_ext_dirs(buf);
|
||||
}
|
||||
#undef EXT_DIR
|
||||
|
@ -1302,7 +1302,7 @@ bool InstructForm::check_branch_variant(ArchDesc &AD, InstructForm *short_branch
|
||||
void InstructForm::rep_var_format(FILE *fp, const char *rep_var) {
|
||||
// Handle special constant table variables.
|
||||
if (strcmp(rep_var, "constanttablebase") == 0) {
|
||||
fprintf(fp, "char reg[128]; ra->dump_register(in(mach_constant_base_node_input()), reg);\n");
|
||||
fprintf(fp, "char reg[128]; ra->dump_register(in(mach_constant_base_node_input()), reg, sizeof(reg));\n");
|
||||
fprintf(fp, " st->print(\"%%s\", reg);\n");
|
||||
return;
|
||||
}
|
||||
@ -2501,7 +2501,7 @@ void OperandForm::int_format(FILE *fp, FormDict &globals, uint index) {
|
||||
strcmp(ideal_type(globalAD->globalNames()), "RegFlags") == 0)) {
|
||||
// !!!!! !!!!!
|
||||
fprintf(fp," { char reg_str[128];\n");
|
||||
fprintf(fp," ra->dump_register(node,reg_str);\n");
|
||||
fprintf(fp," ra->dump_register(node,reg_str, sizeof(reg_str));\n");
|
||||
fprintf(fp," st->print(\"%cs\",reg_str);\n",'%');
|
||||
fprintf(fp," }\n");
|
||||
} else if (_matrule && (dtype = _matrule->is_base_constant(globals)) != Form::none) {
|
||||
@ -2509,7 +2509,7 @@ void OperandForm::int_format(FILE *fp, FormDict &globals, uint index) {
|
||||
} else if (ideal_to_sReg_type(_ident) != Form::none) {
|
||||
// Special format for Stack Slot Register
|
||||
fprintf(fp," { char reg_str[128];\n");
|
||||
fprintf(fp," ra->dump_register(node,reg_str);\n");
|
||||
fprintf(fp," ra->dump_register(node,reg_str, sizeof(reg_str));\n");
|
||||
fprintf(fp," st->print(\"%cs\",reg_str);\n",'%');
|
||||
fprintf(fp," }\n");
|
||||
} else {
|
||||
@ -2530,7 +2530,7 @@ void OperandForm::ext_format(FILE *fp, FormDict &globals, uint index) {
|
||||
fprintf(fp," { char reg_str[128];\n");
|
||||
fprintf(fp," ra->dump_register(node->in(idx");
|
||||
if ( index != 0 ) fprintf(fp, "+%d",index);
|
||||
fprintf(fp, "),reg_str);\n");
|
||||
fprintf(fp, "),reg_str,sizeof(reg_str));\n");
|
||||
fprintf(fp," st->print(\"%cs\",reg_str);\n",'%');
|
||||
fprintf(fp," }\n");
|
||||
} else if (_matrule && (dtype = _matrule->is_base_constant(globals)) != Form::none) {
|
||||
@ -2540,7 +2540,7 @@ void OperandForm::ext_format(FILE *fp, FormDict &globals, uint index) {
|
||||
fprintf(fp," { char reg_str[128];\n");
|
||||
fprintf(fp," ra->dump_register(node->in(idx");
|
||||
if ( index != 0 ) fprintf(fp, "+%d",index);
|
||||
fprintf(fp, "),reg_str);\n");
|
||||
fprintf(fp, "),reg_str,sizeof(reg_str));\n");
|
||||
fprintf(fp," st->print(\"%cs\",reg_str);\n",'%');
|
||||
fprintf(fp," }\n");
|
||||
} else {
|
||||
|
@ -364,7 +364,7 @@ static void format_helper( PhaseRegAlloc *regalloc, outputStream* st, Node *n, c
|
||||
if (regalloc->node_regs_max_index() > 0 &&
|
||||
OptoReg::is_valid(regalloc->get_reg_first(n))) { // Check for undefined
|
||||
char buf[50];
|
||||
regalloc->dump_register(n,buf);
|
||||
regalloc->dump_register(n,buf,sizeof(buf));
|
||||
st->print(" %s%d]=%s",msg,i,buf);
|
||||
} else { // No register, but might be constant
|
||||
const Type *t = n->bottom_type();
|
||||
|
@ -2785,7 +2785,7 @@ void BlackholeNode::format(PhaseRegAlloc* ra, outputStream* st) const {
|
||||
st->print(", ");
|
||||
}
|
||||
char buf[128];
|
||||
ra->dump_register(n, buf);
|
||||
ra->dump_register(n, buf, sizeof(buf));
|
||||
st->print("%s", buf);
|
||||
}
|
||||
}
|
||||
|
@ -2183,42 +2183,42 @@ void PhaseChaitin::dump_simplified() const {
|
||||
tty->cr();
|
||||
}
|
||||
|
||||
static char *print_reg(OptoReg::Name reg, const PhaseChaitin* pc, char* buf) {
|
||||
static char *print_reg(OptoReg::Name reg, const PhaseChaitin* pc, char* buf, size_t buf_size) {
|
||||
if ((int)reg < 0)
|
||||
sprintf(buf, "<OptoReg::%d>", (int)reg);
|
||||
os::snprintf_checked(buf, buf_size, "<OptoReg::%d>", (int)reg);
|
||||
else if (OptoReg::is_reg(reg))
|
||||
strcpy(buf, Matcher::regName[reg]);
|
||||
else
|
||||
sprintf(buf,"%s + #%d",OptoReg::regname(OptoReg::c_frame_pointer),
|
||||
os::snprintf_checked(buf, buf_size, "%s + #%d",OptoReg::regname(OptoReg::c_frame_pointer),
|
||||
pc->reg2offset(reg));
|
||||
return buf+strlen(buf);
|
||||
}
|
||||
|
||||
// Dump a register name into a buffer. Be intelligent if we get called
|
||||
// before allocation is complete.
|
||||
char *PhaseChaitin::dump_register(const Node* n, char* buf) const {
|
||||
char *PhaseChaitin::dump_register(const Node* n, char* buf, size_t buf_size) const {
|
||||
if( _node_regs ) {
|
||||
// Post allocation, use direct mappings, no LRG info available
|
||||
print_reg( get_reg_first(n), this, buf );
|
||||
print_reg( get_reg_first(n), this, buf, buf_size);
|
||||
} else {
|
||||
uint lidx = _lrg_map.find_const(n); // Grab LRG number
|
||||
if( !_ifg ) {
|
||||
sprintf(buf,"L%d",lidx); // No register binding yet
|
||||
os::snprintf_checked(buf, buf_size, "L%d",lidx); // No register binding yet
|
||||
} else if( !lidx ) { // Special, not allocated value
|
||||
strcpy(buf,"Special");
|
||||
} else {
|
||||
if (lrgs(lidx)._is_vector) {
|
||||
if (lrgs(lidx).mask().is_bound_set(lrgs(lidx).num_regs()))
|
||||
print_reg( lrgs(lidx).reg(), this, buf ); // a bound machine register
|
||||
print_reg( lrgs(lidx).reg(), this, buf, buf_size); // a bound machine register
|
||||
else
|
||||
sprintf(buf,"L%d",lidx); // No register binding yet
|
||||
os::snprintf_checked(buf, buf_size, "L%d",lidx); // No register binding yet
|
||||
} else if( (lrgs(lidx).num_regs() == 1)
|
||||
? lrgs(lidx).mask().is_bound1()
|
||||
: lrgs(lidx).mask().is_bound_pair() ) {
|
||||
// Hah! We have a bound machine register
|
||||
print_reg( lrgs(lidx).reg(), this, buf );
|
||||
print_reg( lrgs(lidx).reg(), this, buf, buf_size);
|
||||
} else {
|
||||
sprintf(buf,"L%d",lidx); // No register binding yet
|
||||
os::snprintf_checked(buf, buf_size, "L%d",lidx); // No register binding yet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ private:
|
||||
|
||||
public:
|
||||
void dump_frame() const;
|
||||
char *dump_register(const Node* n, char* buf) const;
|
||||
char *dump_register(const Node* n, char* buf, size_t buf_size) const;
|
||||
private:
|
||||
static void print_chaitin_statistics();
|
||||
#endif // not PRODUCT
|
||||
|
@ -528,7 +528,7 @@ void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) {
|
||||
if (index >= 10) {
|
||||
print_prop(short_name, "PA");
|
||||
} else {
|
||||
sprintf(buffer, "P%d", index);
|
||||
os::snprintf_checked(buffer, sizeof(buffer), "P%d", index);
|
||||
print_prop(short_name, buffer);
|
||||
}
|
||||
} else if (strcmp(node->Name(), "IfTrue") == 0) {
|
||||
@ -544,7 +544,7 @@ void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) {
|
||||
|
||||
// max. 2 chars allowed
|
||||
if (value >= -9 && value <= 99) {
|
||||
sprintf(buffer, "%d", value);
|
||||
os::snprintf_checked(buffer, sizeof(buffer), "%d", value);
|
||||
print_prop(short_name, buffer);
|
||||
} else {
|
||||
print_prop(short_name, "I");
|
||||
@ -558,7 +558,7 @@ void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) {
|
||||
|
||||
// max. 2 chars allowed
|
||||
if (value >= -9 && value <= 99) {
|
||||
sprintf(buffer, JLONG_FORMAT, value);
|
||||
os::snprintf_checked(buffer, sizeof(buffer), JLONG_FORMAT, value);
|
||||
print_prop(short_name, buffer);
|
||||
} else {
|
||||
print_prop(short_name, "L");
|
||||
@ -621,7 +621,7 @@ void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) {
|
||||
|
||||
if (_chaitin && _chaitin != (PhaseChaitin *)((intptr_t)0xdeadbeef)) {
|
||||
buffer[0] = 0;
|
||||
_chaitin->dump_register(node, buffer);
|
||||
_chaitin->dump_register(node, buffer, sizeof(buffer));
|
||||
print_prop("reg", buffer);
|
||||
uint lrg_id = 0;
|
||||
if (node->_idx < _chaitin->_lrg_map.size()) {
|
||||
|
@ -2276,11 +2276,11 @@ void PrintBFS::print_node_idx(const Node* n) {
|
||||
Compile* C = Compile::current();
|
||||
char buf[30];
|
||||
if (n == nullptr) {
|
||||
sprintf(buf,"_"); // null
|
||||
os::snprintf_checked(buf, sizeof(buf), "_"); // null
|
||||
} else if (C->node_arena()->contains(n)) {
|
||||
sprintf(buf, "%d", n->_idx); // new node
|
||||
os::snprintf_checked(buf, sizeof(buf), "%d", n->_idx); // new node
|
||||
} else {
|
||||
sprintf(buf, "o%d", n->_idx); // old node
|
||||
os::snprintf_checked(buf, sizeof(buf), "o%d", n->_idx); // old node
|
||||
}
|
||||
tty->print("%6s", buf);
|
||||
}
|
||||
@ -2288,7 +2288,7 @@ void PrintBFS::print_node_idx(const Node* n) {
|
||||
void PrintBFS::print_block_id(const Block* b) {
|
||||
Compile* C = Compile::current();
|
||||
char buf[30];
|
||||
sprintf(buf, "B%d", b->_pre_order);
|
||||
os::snprintf_checked(buf, sizeof(buf), "B%d", b->_pre_order);
|
||||
tty->print("%7s", buf);
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public:
|
||||
static int _max_framesize;
|
||||
|
||||
virtual void dump_frame() const = 0;
|
||||
virtual char *dump_register( const Node *n, char *buf ) const = 0;
|
||||
virtual char *dump_register( const Node *n, char *buf, size_t buf_size) const = 0;
|
||||
static void print_statistics();
|
||||
#endif
|
||||
};
|
||||
|
@ -1637,17 +1637,17 @@ bool TypeInt::is_finite() const {
|
||||
//------------------------------dump2------------------------------------------
|
||||
// Dump TypeInt
|
||||
#ifndef PRODUCT
|
||||
static const char* intname(char* buf, jint n) {
|
||||
static const char* intname(char* buf, size_t buf_size, jint n) {
|
||||
if (n == min_jint)
|
||||
return "min";
|
||||
else if (n < min_jint + 10000)
|
||||
sprintf(buf, "min+" INT32_FORMAT, n - min_jint);
|
||||
os::snprintf_checked(buf, buf_size, "min+" INT32_FORMAT, n - min_jint);
|
||||
else if (n == max_jint)
|
||||
return "max";
|
||||
else if (n > max_jint - 10000)
|
||||
sprintf(buf, "max-" INT32_FORMAT, max_jint - n);
|
||||
os::snprintf_checked(buf, buf_size, "max-" INT32_FORMAT, max_jint - n);
|
||||
else
|
||||
sprintf(buf, INT32_FORMAT, n);
|
||||
os::snprintf_checked(buf, buf_size, INT32_FORMAT, n);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -1656,7 +1656,7 @@ void TypeInt::dump2( Dict &d, uint depth, outputStream *st ) const {
|
||||
if (_lo == min_jint && _hi == max_jint)
|
||||
st->print("int");
|
||||
else if (is_con())
|
||||
st->print("int:%s", intname(buf, get_con()));
|
||||
st->print("int:%s", intname(buf, sizeof(buf), get_con()));
|
||||
else if (_lo == BOOL->_lo && _hi == BOOL->_hi)
|
||||
st->print("bool");
|
||||
else if (_lo == BYTE->_lo && _hi == BYTE->_hi)
|
||||
@ -1666,11 +1666,11 @@ void TypeInt::dump2( Dict &d, uint depth, outputStream *st ) const {
|
||||
else if (_lo == SHORT->_lo && _hi == SHORT->_hi)
|
||||
st->print("short");
|
||||
else if (_hi == max_jint)
|
||||
st->print("int:>=%s", intname(buf, _lo));
|
||||
st->print("int:>=%s", intname(buf, sizeof(buf), _lo));
|
||||
else if (_lo == min_jint)
|
||||
st->print("int:<=%s", intname(buf, _hi));
|
||||
st->print("int:<=%s", intname(buf, sizeof(buf), _hi));
|
||||
else
|
||||
st->print("int:%s..%s", intname(buf, _lo), intname(buf2, _hi));
|
||||
st->print("int:%s..%s", intname(buf, sizeof(buf), _lo), intname(buf2, sizeof(buf2), _hi));
|
||||
|
||||
if (_widen != 0 && this != TypeInt::INT)
|
||||
st->print(":%.*s", _widen, "wwww");
|
||||
@ -1903,37 +1903,37 @@ bool TypeLong::is_finite() const {
|
||||
//------------------------------dump2------------------------------------------
|
||||
// Dump TypeLong
|
||||
#ifndef PRODUCT
|
||||
static const char* longnamenear(jlong x, const char* xname, char* buf, jlong n) {
|
||||
static const char* longnamenear(jlong x, const char* xname, char* buf, size_t buf_size, jlong n) {
|
||||
if (n > x) {
|
||||
if (n >= x + 10000) return NULL;
|
||||
sprintf(buf, "%s+" JLONG_FORMAT, xname, n - x);
|
||||
os::snprintf_checked(buf, buf_size, "%s+" JLONG_FORMAT, xname, n - x);
|
||||
} else if (n < x) {
|
||||
if (n <= x - 10000) return NULL;
|
||||
sprintf(buf, "%s-" JLONG_FORMAT, xname, x - n);
|
||||
os::snprintf_checked(buf, buf_size, "%s-" JLONG_FORMAT, xname, x - n);
|
||||
} else {
|
||||
return xname;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
static const char* longname(char* buf, jlong n) {
|
||||
static const char* longname(char* buf, size_t buf_size, jlong n) {
|
||||
const char* str;
|
||||
if (n == min_jlong)
|
||||
return "min";
|
||||
else if (n < min_jlong + 10000)
|
||||
sprintf(buf, "min+" JLONG_FORMAT, n - min_jlong);
|
||||
os::snprintf_checked(buf, buf_size, "min+" JLONG_FORMAT, n - min_jlong);
|
||||
else if (n == max_jlong)
|
||||
return "max";
|
||||
else if (n > max_jlong - 10000)
|
||||
sprintf(buf, "max-" JLONG_FORMAT, max_jlong - n);
|
||||
else if ((str = longnamenear(max_juint, "maxuint", buf, n)) != NULL)
|
||||
os::snprintf_checked(buf, buf_size, "max-" JLONG_FORMAT, max_jlong - n);
|
||||
else if ((str = longnamenear(max_juint, "maxuint", buf, buf_size, n)) != NULL)
|
||||
return str;
|
||||
else if ((str = longnamenear(max_jint, "maxint", buf, n)) != NULL)
|
||||
else if ((str = longnamenear(max_jint, "maxint", buf, buf_size, n)) != NULL)
|
||||
return str;
|
||||
else if ((str = longnamenear(min_jint, "minint", buf, n)) != NULL)
|
||||
else if ((str = longnamenear(min_jint, "minint", buf, buf_size, n)) != NULL)
|
||||
return str;
|
||||
else
|
||||
sprintf(buf, JLONG_FORMAT, n);
|
||||
os::snprintf_checked(buf, buf_size, JLONG_FORMAT, n);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -1942,13 +1942,13 @@ void TypeLong::dump2( Dict &d, uint depth, outputStream *st ) const {
|
||||
if (_lo == min_jlong && _hi == max_jlong)
|
||||
st->print("long");
|
||||
else if (is_con())
|
||||
st->print("long:%s", longname(buf, get_con()));
|
||||
st->print("long:%s", longname(buf, sizeof(buf), get_con()));
|
||||
else if (_hi == max_jlong)
|
||||
st->print("long:>=%s", longname(buf, _lo));
|
||||
st->print("long:>=%s", longname(buf, sizeof(buf), _lo));
|
||||
else if (_lo == min_jlong)
|
||||
st->print("long:<=%s", longname(buf, _hi));
|
||||
st->print("long:<=%s", longname(buf, sizeof(buf), _hi));
|
||||
else
|
||||
st->print("long:%s..%s", longname(buf, _lo), longname(buf2, _hi));
|
||||
st->print("long:%s..%s", longname(buf, sizeof(buf), _lo), longname(buf2,sizeof(buf2), _hi));
|
||||
|
||||
if (_widen != 0 && this != TypeLong::LONG)
|
||||
st->print(":%.*s", _widen, "wwww");
|
||||
|
@ -190,6 +190,7 @@ FORBID_C_FUNCTION(void exit(int), "use os::exit");
|
||||
FORBID_C_FUNCTION(void _exit(int), "use os::exit");
|
||||
FORBID_C_FUNCTION(char* strerror(int), "use os::strerror");
|
||||
FORBID_C_FUNCTION(char* strtok(char*, const char*), "use strtok_r");
|
||||
FORBID_C_FUNCTION(int sprintf(char*, const char*, ...), "use os::snprintf");
|
||||
FORBID_C_FUNCTION(int vsprintf(char*, const char*, va_list), "use os::vsnprintf");
|
||||
FORBID_C_FUNCTION(int vsnprintf(char*, size_t, const char*, va_list), "use os::vsnprintf");
|
||||
|
||||
|
@ -34,7 +34,7 @@ Java_AsyncExceptionOnMonitorEnter_createRawMonitor(JNIEnv *jni, jclass cls) {
|
||||
jvmtiError err;
|
||||
char name[32];
|
||||
|
||||
sprintf(name, "MyRawMonitor");
|
||||
snprintf(name, sizeof(name), "MyRawMonitor");
|
||||
err = jvmti->CreateRawMonitor(name, &monitor);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("CreateRawMonitor unexpected error: (%d)\n", err);
|
||||
@ -82,4 +82,4 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ jint check_add_module_exports(JNIEnv *env,
|
||||
printf("Check #C0:\n");
|
||||
exported = is_exported_to(env, baseModule, pkg, thisModule, open);
|
||||
if (exported != JNI_FALSE) {
|
||||
sprintf(strbuf, "Check #C0: unexpected export of %s from base to this", pkg);
|
||||
snprintf(strbuf, sizeof(strbuf), "Check #C0: unexpected export of %s from base to this", pkg);
|
||||
throw_exc(env, strbuf);
|
||||
return FAILED;
|
||||
}
|
||||
@ -248,7 +248,7 @@ jint check_add_module_exports(JNIEnv *env,
|
||||
err = add_module_exports(baseModule, pkg, thisModule, open);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("#C1: jvmtiError from %s: %d\n", jvmti_fn, err);
|
||||
sprintf(strbuf, "Check #C1: error in add export of %s from base to this", pkg);
|
||||
snprintf(strbuf, sizeof(strbuf), "Check #C1: error in add export of %s from base to this", pkg);
|
||||
throw_exc(env, strbuf);
|
||||
return FAILED;
|
||||
}
|
||||
@ -257,7 +257,7 @@ jint check_add_module_exports(JNIEnv *env,
|
||||
printf("Check #C2:\n");
|
||||
exported = is_exported_to(env, baseModule, pkg, thisModule, open);
|
||||
if (exported == JNI_FALSE) {
|
||||
sprintf(strbuf, "Check #C2: failed to export %s from base to this", pkg);
|
||||
snprintf(strbuf, sizeof(strbuf), "Check #C2: failed to export %s from base to this", pkg);
|
||||
throw_exc(env, strbuf);
|
||||
return FAILED;
|
||||
}
|
||||
@ -266,7 +266,7 @@ jint check_add_module_exports(JNIEnv *env,
|
||||
printf("Check #C3:\n");
|
||||
exported = is_exported(env, baseModule, pkg, open);
|
||||
if (exported != JNI_FALSE) {
|
||||
sprintf(strbuf, "Check #C3: unexpected export of %s from base to all modules", pkg);
|
||||
snprintf(strbuf, sizeof(strbuf), "Check #C3: unexpected export of %s from base to all modules", pkg);
|
||||
throw_exc(env, strbuf);
|
||||
return FAILED;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
|
||||
|
||||
if (inf.name != NULL && strstr(inf.name, prefix) == inf.name) {
|
||||
eventsCount++;
|
||||
sprintf(name, "%s%d", prefix, eventsCount);
|
||||
snprintf(name, sizeof(name), "%s%d", prefix, eventsCount);
|
||||
if (inf.name == NULL || strcmp(name, inf.name) != 0) {
|
||||
LOG("(#%d) wrong thread name: \"%s\"",eventsCount, inf.name);
|
||||
LOG(", expected: \"%s\"\n", name);
|
||||
|
@ -55,7 +55,7 @@ ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
|
||||
LOG(">>> %s\n", inf.name);
|
||||
|
||||
if (inf.name != NULL && strstr(inf.name, prefix) == inf.name) {
|
||||
sprintf(name, "%s%d", prefix, eventsCount);
|
||||
snprintf(name, sizeof(name), "%s%d", prefix, eventsCount);
|
||||
if (strcmp(name, inf.name) != 0) {
|
||||
LOG("(#%d) wrong thread name: \"%s\"", eventsCount, inf.name);
|
||||
LOG(", expected: \"%s\"\n", name);
|
||||
|
@ -51,7 +51,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
|
@ -51,7 +51,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti_env->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
|
@ -51,7 +51,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
@ -142,7 +142,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorEnter_rawmonenter001_check(JNIEn
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
|
@ -51,7 +51,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
@ -155,7 +155,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorExit_rawmonexit001_check(JNIEnv
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
|
@ -51,7 +51,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
@ -168,7 +168,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorNotify_rawmnntfy001_check(JNIEnv
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
|
@ -51,7 +51,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
@ -168,7 +168,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorNotifyAll_rawmnntfyall001_check(
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
|
@ -52,7 +52,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
@ -169,7 +169,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorWait_rawmnwait001_check(JNIEnv *
|
||||
}
|
||||
|
||||
for (i = 0; i < RAW_MONITORS_NUMBER; i++) {
|
||||
sprintf(name, "RawMonitor-%d", i);
|
||||
snprintf(name, sizeof(name), "RawMonitor-%d", i);
|
||||
err = jvmti->CreateRawMonitor(name, &monitors[i]);
|
||||
if (err != JVMTI_ERROR_NONE) {
|
||||
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
|
||||
|
@ -51,10 +51,10 @@ int readNewBytecode(jvmtiEnv* jvmti) {
|
||||
jint read_bytes;
|
||||
|
||||
if (pathToByteCode)
|
||||
sprintf(filename,"%s/%s/%s.class",
|
||||
snprintf(filename, sizeof(filename), "%s/%s/%s.class",
|
||||
pathToByteCode, "newclass02", TESTED_CLASS_NAME);
|
||||
else
|
||||
sprintf(filename,"%s/%s.class",
|
||||
snprintf(filename, sizeof(filename), "%s/%s.class",
|
||||
"newclass02", TESTED_CLASS_NAME);
|
||||
|
||||
NSK_DISPLAY1("Reading new bytecode for java.lang.Object\n\tfile name: %s\n",
|
||||
|
@ -390,7 +390,7 @@ int readNewBytecode(jvmtiEnv* jvmti, int testcase) {
|
||||
return NSK_FALSE;
|
||||
}
|
||||
|
||||
sprintf(filename,"%s/%s%02d/%s.class",
|
||||
snprintf(filename, sizeof(filename), "%s/%s%02d/%s.class",
|
||||
pathToByteCode, "newclass", testcase, EXPECTED_CLASS_NAME);
|
||||
|
||||
NSK_DISPLAY1("\treading new bytecode for the tested class\n\tfile name: %s\n",
|
||||
|
@ -383,7 +383,7 @@ int readNewBytecode(jvmtiEnv* jvmti, jint *newClassSize, unsigned char* *newClas
|
||||
return NSK_FALSE;
|
||||
}
|
||||
|
||||
sprintf(filename,"%s/%s/%s.class",
|
||||
snprintf(filename, sizeof(filename), "%s/%s/%s.class",
|
||||
pathToByteCode, "newclass", EXPECTED_CLASS_NAME);
|
||||
|
||||
NSK_DISPLAY1("\treading new bytecode for the tested class\n\tfile name: %s\n",
|
||||
|
@ -117,7 +117,7 @@ Java_nsk_jvmti_unit_GetAllStackTraces_getallstktr001_CreateRawMonitor(
|
||||
jvmtiError ret;
|
||||
char sz[128];
|
||||
|
||||
sprintf(sz, "Raw-monitor");
|
||||
snprintf(sz, sizeof(sz), "Raw-monitor");
|
||||
ret = jvmti->CreateRawMonitor(sz, &jraw_monitor);
|
||||
|
||||
if (ret != JVMTI_ERROR_NONE) {
|
||||
|
@ -185,7 +185,7 @@ Java_nsk_jvmti_unit_MethodBind_JvmtiTest_CreateRawMonitor(JNIEnv * env, jclass c
|
||||
jvmtiError ret;
|
||||
char sz[128];
|
||||
|
||||
sprintf(sz, "Rawmonitor-%d",i);
|
||||
snprintf(sz, sizeof(sz), "Rawmonitor-%d",i);
|
||||
debug_printf("jvmti create raw monitor \n");
|
||||
ret = jvmti->CreateRawMonitor(sz, &jraw_monitor[i]);
|
||||
|
||||
|
@ -116,7 +116,7 @@ Java_nsk_jvmti_unit_StackTrace_JvmtiTest_CreateRawMonitor(JNIEnv * env, jclass k
|
||||
jvmtiError ret;
|
||||
char sz[128];
|
||||
|
||||
sprintf(sz, "Rawmonitor-%d",i);
|
||||
snprintf(sz, sizeof(sz), "Rawmonitor-%d",i);
|
||||
debug_printf("jvmti create raw monitor \n");
|
||||
ret = jvmti->CreateRawMonitor(sz, &jraw_monitor[i]);
|
||||
|
||||
|
@ -154,7 +154,7 @@ Java_nsk_jvmti_unit_functions_nosuspendStackTrace_JvmtiTest_CreateRawMonitor(JNI
|
||||
jvmtiError ret;
|
||||
char sz[128];
|
||||
|
||||
sprintf(sz, "Rawmonitor-%d",i);
|
||||
snprintf(sz, sizeof(sz), "Rawmonitor-%d",i);
|
||||
debug_printf("jvmti create raw monitor \n");
|
||||
ret = jvmti->CreateRawMonitor(sz, &jraw_monitor[i]);
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
s
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -291,7 +292,7 @@ Java_nsk_jvmti_unit_functions_rawmonitor_CreateRawMonitor(JNIEnv * env, jclass k
|
||||
jvmtiError ret;
|
||||
char sz[128];
|
||||
|
||||
sprintf(sz, "Rawmonitor-%d",i);
|
||||
snprintf(sz, sizeof(sz), "Rawmonitor-%d",i);
|
||||
debug_printf("jvmti create raw monitor \n");
|
||||
ret = jvmti->CreateRawMonitor(sz, &jraw_monitor[i]);
|
||||
|
||||
|
@ -1150,7 +1150,7 @@ static void getVerdict(JNIEnv *jni_env, const char *evnt) {
|
||||
char error_msg[80];
|
||||
|
||||
if (vm_death_occured == TRUE) {
|
||||
sprintf(error_msg, "JVMTIagent: getVerdict: %s event occured after VMDeath",
|
||||
snprintf(error_msg, sizeof(error_msg), "JVMTIagent: getVerdict: %s event occured after VMDeath",
|
||||
evnt);
|
||||
|
||||
if (jni_env == NULL) { /* some event callbacks have no pointer to jni */
|
||||
|
@ -237,7 +237,7 @@ int nsk_jvmti_aod_redefineClass(
|
||||
{
|
||||
char file [1024];
|
||||
|
||||
sprintf(file,"%s/%s.class",
|
||||
snprintf(file, sizeof(file), "%s/%s.class",
|
||||
nsk_aod_getOptionValue(options, PATH_TO_NEW_BYTE_CODE_OPTION),
|
||||
fileName);
|
||||
NSK_DISPLAY1("File with new bytecode: '%s'\n", file);
|
||||
|
@ -466,7 +466,7 @@ int nsk_jvmti_redefineClass(jvmtiEnv * jvmti,
|
||||
{
|
||||
char file [1024];
|
||||
//= "DEFAULT";
|
||||
sprintf(file,"%s/%s.class",
|
||||
snprintf(file, sizeof(file), "%s/%s.class",
|
||||
nsk_jvmti_findOptionValue(NSK_JVMTI_OPT_PATH_TO_NEW_BYTE_CODE),
|
||||
fileName);
|
||||
nsk_printf("# info :: File = %s \n",file);
|
||||
|
@ -279,7 +279,7 @@ void nsk_printHexBytes(const char indent[], int columns,
|
||||
char ch = (char)bytes[i + j];
|
||||
|
||||
if (!(isascii(ch) && isprint(ch))) ch = '.';
|
||||
sprintf(buf, " %02X", b);
|
||||
snprintf(buf, sizeof(buf), " %02X", b);
|
||||
strcat(hex, buf);
|
||||
ascii[j] = ch;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user