summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornight199uk <night199uk@hermitcrabslab.com>2018-10-18 23:18:45 +0200
committerCyrill Gorcunov <gorcunov@gmail.com>2018-10-19 00:55:54 +0300
commite1bd3bc7b497d58efc1c7a5c56dbc591d5be880f (patch)
tree635f320e839a2301d1d786f50d78ff5245079216
parent28b69e2a633a850e724f309a5ec81bac8638084a (diff)
downloadnasm-e1bd3bc7b497d58efc1c7a5c56dbc591d5be880f.tar.gz
path: nasm_catfile -- Fix incorrect return of filename only
nasm_catfile returns an incorrect (already incremented) pointer. https://bugzilla.nasm.us/show_bug.cgi?id=3392205 Signed-off-by: night199uk <night199uk@hermitcrabslab.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--nasmlib/path.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/nasmlib/path.c b/nasmlib/path.c
index 9dadaba8..d228ed1e 100644
--- a/nasmlib/path.c
+++ b/nasmlib/path.c
@@ -164,7 +164,7 @@ char *nasm_catfile(const char *dir, const char *file)
#else
size_t dl = strlen(dir);
size_t fl = strlen(file);
- char *p;
+ char *p, *pp;
bool dosep = true;
if (!dl || ismatch(separators, dir[dl-1])) {
@@ -172,14 +172,14 @@ char *nasm_catfile(const char *dir, const char *file)
dosep = false;
}
- p = nasm_malloc(dl + fl + dosep + 1);
+ p = pp = nasm_malloc(dl + fl + dosep + 1);
- memcpy(p, dir, dl);
- p += dl;
+ memcpy(pp, dir, dl);
+ pp += dl;
if (dosep)
- *p++ = catsep;
+ *pp++ = catsep;
- memcpy(p, file, fl+1);
+ memcpy(pp, file, fl+1);
return p;
#endif