- increase bufsize to prevent out of bound access
- check null before fwrite
Change-Id: I94571b42c10c1fe10bce9ec6532872b42a9a6196
Signed-off-by: Jeon Sang-Heon <sh95.jeon@samsung.com>
goto Cleanup;
}
//write source kernel data to workspace
+ if (!source_file.data) {
+ LOGE("source_file.data is null before fwrite");
+ result = E_SS_FAILURE;
+ goto Cleanup;
+ }
+
read_count = fwrite(source_file.data, 1, source_file.size, fp);
if (read_count != source_file.size) {
LOGE("file write error read_count = %d for [%s]\n", read_count, source_filename);
int SS_Get_last_update_status(int* last_update_status, int* del_type)
{
int fd;
- unsigned char buf[256];
+ unsigned char buf[257];
char *ptr = NULL;
char *saveptr = NULL;
int result = 0;
return -1;
}
- result = SS_ReadFile(fd, 0, buf, sizeof(buf));
+ result = SS_ReadFile(fd, 0, buf, sizeof(buf)-1);
if (result != 0) {
LOGE("SS_ReadFile failed!!\n");
result = SS_CloseFile(fd);