summaryrefslogtreecommitdiff
path: root/lib/fprint.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2022-05-06 11:27:10 +0300
committerPanu Matilainen <pmatilai@redhat.com>2022-05-06 11:27:10 +0300
commit328ff700a3260190bb4b980632a864e05845d0d2 (patch)
tree9ff8baed96736e53fadd5b183bc9a22c6700c927 /lib/fprint.c
parent09ad6fa904e754838e20c8df489d95b10e53b56a (diff)
downloadrpm-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.c10
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';
}