@@ -1327,12 +1327,15 @@ static void load_elf_image(const char *image_name, int image_fd,
goto exit_errmsg;
}
interp_name = malloc(eppnt->p_filesz);
+ if (!interp_name) {
+ goto exit_perror;
+ }
if (eppnt->p_offset + eppnt->p_filesz <= BPRM_BUF_SIZE) {
memcpy(interp_name, bprm_buf + eppnt->p_offset,
eppnt->p_filesz);
} else {
- retval = pread(image_fd, interp_name, eppnt->p_filesz,
+ retval = pread(image_fd, interp_name, eppnt->p_filesz,
eppnt->p_offset);
if (retval != eppnt->p_filesz) {
goto exit_perror;