diff options
author | Martin Sebor <msebor@redhat.com> | 2021-10-11 09:36:57 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2021-10-11 09:36:57 -0600 |
commit | eb73b87897798de981dbbf019aa957045d768adb (patch) | |
tree | 4cc7e81a223836418f367f68b6edb9a781bab0b8 /resolv | |
parent | 5d26d12f4ab59c67399c4d5ddcad91704fb737f9 (diff) | |
download | glibc-eb73b87897798de981dbbf019aa957045d768adb.zip glibc-eb73b87897798de981dbbf019aa957045d768adb.tar.gz glibc-eb73b87897798de981dbbf019aa957045d768adb.tar.bz2 |
resolv: Avoid GCC 12 false positive warning [BZ #28439].
Replace a call to sprintf with an equivalent pair of stpcpy/strcpy calls
to avoid a GCC 12 -Wformat-overflow false positive due to recent optimizer
improvements.
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/res_query.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/resolv/res_query.c b/resolv/res_query.c index 75b0e5f..5d0a68d 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -610,7 +610,9 @@ __res_context_querydomain (struct resolv_context *ctx, RES_SET_H_ERRNO(statp, NO_RECOVERY); return (-1); } - sprintf(nbuf, "%s.%s", name, domain); + char *p = __stpcpy (nbuf, name); + *p++ = '.'; + strcpy (p, domain); } return __res_context_query (ctx, longname, class, type, answer, anslen, answerp, answerp2, nanswerp2, |