mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-11 19:17:22 +00:00
Fix possible buffer overflow in buf2str() in 'lib/helper.c'.
This commit is contained in:
parent
54cc84adf2
commit
c9b53b1b32
@ -73,13 +73,13 @@ uint16_t buf2short(uint8_t * buf)
|
|||||||
|
|
||||||
const char * buf2str(uint8_t * buf, int len)
|
const char * buf2str(uint8_t * buf, int len)
|
||||||
{
|
{
|
||||||
static char str[1024];
|
static char str[2049];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (len <= 0 || len > 1024)
|
if (len <= 0 || len > 1024)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(str, 0, 1024);
|
memset(str, 0, 2049);
|
||||||
|
|
||||||
for (i=0; i<len; i++)
|
for (i=0; i<len; i++)
|
||||||
sprintf(str+i+i, "%2.2x", buf[i]);
|
sprintf(str+i+i, "%2.2x", buf[i]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user