aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2026-04-28 14:26:14 +0200
committerWerner Koch <[email protected]>2026-04-28 14:26:14 +0200
commit48fae7f604398035ab8cb9970301667312231471 (patch)
tree06c1f25701e4d84897c945c1760b921a67a1cb5e /src
parentpo: Update Japanese Translation. (diff)
downloadlibgpg-error-48fae7f604398035ab8cb9970301667312231471.tar.gz
libgpg-error-48fae7f604398035ab8cb9970301667312231471.zip
Fix out-of-bounds read in vfnameconcat.
* src/stringutils.c (_gpgrt_vfnameconcat): Use the correct value for the trailing slash check. -- Reported-by: Dirk Mueller <[email protected]> (AI)
Diffstat (limited to 'src')
-rw-r--r--src/stringutils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/stringutils.c b/src/stringutils.c
index 1d3b920..539c116 100644
--- a/src/stringutils.c
+++ b/src/stringutils.c
@@ -67,7 +67,7 @@ _gpgrt_vfnameconcat (unsigned int flags,
{
const char *argv[32];
int argc;
- size_t n;
+ size_t n, n0;
int skip = 1; /* Characters to skip from FIRST_PART. Only used if
* HOME is NULL */
char *home_buffer = NULL;
@@ -101,8 +101,9 @@ _gpgrt_vfnameconcat (unsigned int flags,
home = SYSCONFDIR;
#endif
skip = 0;
- n += strlen (home);
- if (n && home[n-1] != '/' && *first_part != '/')
+ n0 = strlen (home);
+ n += n0;
+ if (n0 && home[n0-1] != '/' && *first_part != '/')
{
extradelim = "/";
n++;