diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-08-24 10:28:27 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-08-24 15:33:18 +0200 |
commit | d84b53aa06fbcf529deb413e18c5c4f3e562c6dc (patch) | |
tree | faa3052a9c5599635b38550956ce43345e635aca | |
parent | c43a54f6dc45590ce553a294ae59bd14324212f2 (diff) |
source: avoid null pointer access in uc_source_runpath_set()
When loading a precompiled program from stdin, the input source runpath
is unset which subsequently leads to a null pointer being passed to
uc_source_runpath_set() when will then attempt to strdup() it, leading
to a null pointer access.
Properly handle this case and only duplicate non-null pointers.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | source.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -194,7 +194,7 @@ uc_source_runpath_set(uc_source_t *source, const char *runpath) if (source->runpath != source->filename) free(source->runpath); - source->runpath = xstrdup(runpath); + source->runpath = runpath ? xstrdup(runpath) : NULL; } bool |