Merge pull request #1199 from signalwire/fix-compile-error

[core] Fix read of uninitialized buffer in switch_simple_email().
This commit is contained in:
Andrey Volk 2021-05-17 16:54:06 +03:00 committed by GitHub
commit 7f86d25c6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -1128,6 +1128,8 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
switch_bool_t rval = SWITCH_FALSE;
const char *err = NULL;
filename[0] = '\0';
if (zstr(to)) {
err = "No to address specified";
goto end;
@ -1323,7 +1325,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
close(fd);
}
if (unlink(filename) != 0) {
if (!zstr_buf(filename) && unlink(filename) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", filename);
}