diff options
author | Daniel J. Hofmann <daniel@trvx.org> | 2014-05-10 16:01:44 +0200 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2014-07-06 20:54:19 -0700 |
commit | 706286c28956e51873bfe6b673bea5be01ee7839 (patch) | |
tree | 5ffb3757b27e529ecd38af8fd14511699af8fc96 /mimedb.cpp | |
parent | 18c1b127418e211583968db6365a2205c91a794c (diff) |
Fixes use-after-free issue.
Calling writer() might fail in which case launch_buff gets freed.
This patch prevents the subsequent use of memory after it was freed.
Diffstat (limited to 'mimedb.cpp')
-rw-r--r-- | mimedb.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1190,6 +1190,12 @@ static void launch(char *filter, const string_list_t &files, size_t fileno) writer('&'); writer('\0'); + /* + Calling writer might fail in which case launch_buff gets freed. + */ + if (error) + return; + if (system(launch_buff) == -1) { fprintf(stderr, _(ERROR_SYSTEM), MIMEDB, launch_buff); |