diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2022-05-06 11:27:10 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2022-05-06 11:27:10 +0300 |
commit | 328ff700a3260190bb4b980632a864e05845d0d2 (patch) | |
tree | 9ff8baed96736e53fadd5b183bc9a22c6700c927 /lib/fprint.c | |
parent | 09ad6fa904e754838e20c8df489d95b10e53b56a (diff) | |
download | rpm-328ff700a3260190bb4b980632a864e05845d0d2.tar.gz |
Oops, fixup remnants of old realpath() semantics in fingerprinting
The subsequent code relied on buffer lenght being explicit PATH_MAX
which certainly was no longer the case. Clearly, our test-suite does
not excercise this code...
Should've been in commit b1bc46e56a9c267ca7e5ed263c4649dae017914b
Diffstat (limited to 'lib/fprint.c')
-rw-r--r-- | lib/fprint.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/fprint.c b/lib/fprint.c index f097834e1..b359697a3 100644 --- a/lib/fprint.c +++ b/lib/fprint.c @@ -148,15 +148,11 @@ static char * canonDir(rpmstrPool pool, rpmsid dirNameId) * the result. */ - /* if the current directory doesn't exist, we might fail. - oh well. likewise if it's too long. */ + /* if the current directory doesn't exist, we might fail. oh well. */ if ((cdnbuf = realpath(".", NULL)) != NULL) { - char *end = cdnbuf + strlen(cdnbuf); - if (end[-1] != '/') *end++ = '/'; - end = stpncpy(end, dirName, PATH_MAX - (end - cdnbuf)); - *end = '\0'; + cdnbuf = rstrscat(&cdnbuf, "/", dirName, NULL); (void)rpmCleanPath(cdnbuf); /* XXX possible /../ from concatenation */ - end = cdnbuf + strlen(cdnbuf); + char *end = cdnbuf + strlen(cdnbuf); if (end[-1] != '/') *end++ = '/'; *end = '\0'; } |