mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
ID:335 - Check return value of fseek(), prevent segfault
Commit adds a check as a workaround for segfault reported in ID:335. However, the proper fix is to rewrite parts of lib/ipmi_hpmfwupg.c not to put whole firmware image into memory. Also, MD5 checksum part needs to be rewritten, because it won't work for large firmware images.
This commit is contained in:
parent
4ecac48c68
commit
9341982a38
@ -1399,7 +1399,12 @@ HpmfwupgGetBufferFromFile(char *imageFilename,
|
|||||||
return HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
/* Get the raw data in file */
|
/* Get the raw data in file */
|
||||||
fseek(pImageFile, 0, SEEK_END);
|
ret = fseek(pImageFile, 0, SEEK_END);
|
||||||
|
if (ret != 0) {
|
||||||
|
lprintf(LOG_ERR, "Failed to seek in the image file '%s'",
|
||||||
|
imageFilename);
|
||||||
|
return HPMFWUPG_ERROR;
|
||||||
|
}
|
||||||
pFwupgCtx->imageSize = ftell(pImageFile);
|
pFwupgCtx->imageSize = ftell(pImageFile);
|
||||||
pFwupgCtx->pImageData = malloc(sizeof(unsigned char)*pFwupgCtx->imageSize);
|
pFwupgCtx->pImageData = malloc(sizeof(unsigned char)*pFwupgCtx->imageSize);
|
||||||
if (pFwupgCtx->pImageData == NULL) {
|
if (pFwupgCtx->pImageData == NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user