This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=0fee7b211d8f31067bb444268860d995a8c1ba1e commit 0fee7b211d8f31067bb444268860d995a8c1ba1e (HEAD -> main) Author: Guillem Jover <[email protected]> AuthorDate: Tue Jul 9 04:18:47 2024 +0200 dpkg-realpath: Switch direct varbuf accesses to varbuf_str() Make these accesses more robust by using varbuf_str(), so that even if the varbufs are empty we do not need to worry about handling a NULL pointer. Changelog: internal --- src/realpath/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/realpath/main.c b/src/realpath/main.c index b4a2d1d21..5d41adf6c 100644 --- a/src/realpath/main.c +++ b/src/realpath/main.c @@ -99,7 +99,7 @@ realpath_relative_to(const char *pathname, const char *rootdir) varbuf_set_str(&result, rootdir); /* Check whether the path is relative, make it absolute otherwise. */ - if (src.buf[0] != '/') { + if (varbuf_str(&src)[0] != '/') { struct varbuf abs_src = VARBUF_INIT; file_getcwd(&abs_src); @@ -139,7 +139,7 @@ realpath_relative_to(const char *pathname, const char *rootdir) /* Ignore, stay at the same directory. */ } else if (strcmp(prefix.buf, "..") == 0) { /* Go up one directory. */ - slash = strrchr(result.buf, '/'); + slash = strrchr(varbuf_str(&result), '/'); if (slash != NULL) varbuf_trunc(&result, slash - result.buf); @@ -160,7 +160,7 @@ realpath_relative_to(const char *pathname, const char *rootdir) ohshit(_("symbolic link '%s' size has changed from %jd to %zd"), slink.buf, (intmax_t)st.st_size, linksize); - if (dst.buf[0] == '/') { + if (varbuf_str(&dst)[0] == '/') { /* Absolute pathname, reset result back to * root. */ varbuf_set_varbuf(&result, &root); -- Dpkg.Org's dpkg

