Avoid use of sprintf in gdb/utils.c:make_hex_string

The use of sprintf is discouraged in GDB. Use xsnprintf instead.

gdb/ChangeLog:

        * utils.c (make_hex_string): Replace use of sprintf by use of
        xsnprintf.

Tested on x86_64-linux.
This commit is contained in:
Joel Brobecker 2014-12-13 10:19:03 -05:00
parent 8e8347b895
commit 3c46a02f50
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2014-12-13 Joel Brobecker <brobecker@adacore.com>
* utils.c (make_hex_string): Replace use of sprintf by use of
xsnprintf.
2014-12-13 Joel Brobecker <brobecker@adacore.com>
* compile/compile-object-load.c (link_callbacks_multiple_definition)

View File

@ -1124,7 +1124,7 @@ make_hex_string (const gdb_byte *data, size_t length)
p = result;
for (i = 0; i < length; ++i)
p += sprintf (p, "%02x", data[i]);
p += xsnprintf (p, 2, "%02x", data[i]);
*p = '\0';
return result;
}