summaryrefslogtreecommitdiffhomepage
path: root/source.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-08-24 10:28:27 +0200
committerJo-Philipp Wich <jo@mein.io>2022-08-24 15:33:18 +0200
commitd84b53aa06fbcf529deb413e18c5c4f3e562c6dc (patch)
treefaa3052a9c5599635b38550956ce43345e635aca /source.c
parentc43a54f6dc45590ce553a294ae59bd14324212f2 (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>
Diffstat (limited to 'source.c')
-rw-r--r--source.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source.c b/source.c
index 902ad4c..3bdc210 100644
--- a/source.c
+++ b/source.c
@@ -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