added TODOs about potential overflows in core_i64_hex_format() and core_i64_oct_format()

This commit is contained in:
Oliver Stöneberg 2014-03-10 22:28:24 +00:00
parent d59e387a7a
commit 485142eb87

View File

@ -127,6 +127,7 @@ char *core_strdup(const char *str)
char *core_i64_hex_format(UINT64 value, UINT8 mindigits) char *core_i64_hex_format(UINT64 value, UINT8 mindigits)
{ {
static char buffer[16][64]; static char buffer[16][64];
// TODO: this can overflow - e.g. when a lot of unmapped writes are logged
static int index; static int index;
char *bufbase = &buffer[index++ % 16][0]; char *bufbase = &buffer[index++ % 16][0];
char *bufptr = bufbase; char *bufptr = bufbase;
@ -155,6 +156,7 @@ char *core_i64_hex_format(UINT64 value, UINT8 mindigits)
char *core_i64_oct_format(UINT64 value, UINT8 mindigits) char *core_i64_oct_format(UINT64 value, UINT8 mindigits)
{ {
static char buffer[22][64]; static char buffer[22][64];
// TODO: this can overflow
static int index; static int index;
char *bufbase = &buffer[index++ % 22][0]; char *bufbase = &buffer[index++ % 22][0];
char *bufptr = bufbase; char *bufptr = bufbase;