diff options
author | Martin Sebor <msebor@redhat.com> | 2021-10-11 09:36:57 -0600 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2023-01-11 13:34:00 +0100 |
commit | 92d5c52aaac0fa8e58b92e96bf2025d6848a2845 (patch) | |
tree | 28d55ae445bda302c02763f7eee1ac94d17536c9 | |
parent | d36f457870a807f6f29880a2f2bde5e9b761f00c (diff) | |
download | glibc-92d5c52aaac0fa8e58b92e96bf2025d6848a2845.tar glibc-92d5c52aaac0fa8e58b92e96bf2025d6848a2845.tar.gz glibc-92d5c52aaac0fa8e58b92e96bf2025d6848a2845.tar.bz2 glibc-92d5c52aaac0fa8e58b92e96bf2025d6848a2845.zip |
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.
(cherry picked from commit eb73b87897798de981dbbf019aa957045d768adb)
-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 75b0e5f2f7..5d0a68dc81 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, |