protect against null deref when emitting efm/eeze error messages

CID 1382954
This commit is contained in:
Mike Blumenkrantz 2018-01-08 10:41:45 -05:00
parent 31e5559658
commit 96a67811a1
1 changed files with 5 additions and 2 deletions

View File

@ -108,14 +108,17 @@ _e_fm_main_eeze_format_error_msg(char **buf,
char *tmp;
vu = strlen(v->udi) + 1;
vm = strlen(v->mount_point) + 1;
vm = (v->mount_point ? strlen(v->mount_point) : 0) + 1;
en = strlen(name) + 1;
size = vu + vm + en + strlen(msg) + 1;
tmp = *buf = malloc(size);
strcpy(tmp, v->udi);
tmp += vu;
strcpy(tmp, v->mount_point);
if (v->mount_point)
strcpy(tmp, v->mount_point);
else
tmp[0] = 0;
tmp += vm;
strcpy(tmp, name);
tmp += en;