diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache -x .deps -x .libs ../orig-ipmitool-1.8.13/lib/ipmi_fwum.c ./lib/ipmi_fwum.c --- ../orig-ipmitool-1.8.13/lib/ipmi_fwum.c 2013-08-23 21:02:34.000000000 +0200 +++ ./lib/ipmi_fwum.c 2013-10-04 08:43:50.435904445 +0200 @@ -142,7 +142,8 @@ extern int verbose; static unsigned char fileName[512]; -static unsigned char firmBuf[1024*512]; +#define MAX_FW_FILE_SIZE 1024*512 +static unsigned char firmBuf[MAX_FW_FILE_SIZE]; static tKFWUM_SaveFirmwareInfo saveFirmwareInfo; static void KfwumOutputHelp(void); @@ -476,6 +477,12 @@ tKFWUM_Status status = KFWUM_STATUS_ERROR; FILE * pFileHandle; + if(fileSize >= MAX_FW_FILE_SIZE) + { + printf("Error: Firmware file size exceeds %dK\n", MAX_FW_FILE_SIZE / 1024); + return KFWUM_STATUS_ERROR; + } + pFileHandle = fopen((const char *)pFileName, "rb"); if(pFileHandle) @@ -764,6 +771,7 @@ } } } + fclose(pFileHandle); } return status; }