public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/release/2.34/master] resolv: Avoid GCC 12 false positive warning [BZ #28439].
@ 2023-01-12 6:21 Florian Weimer
0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2023-01-12 6:21 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=92d5c52aaac0fa8e58b92e96bf2025d6848a2845
commit 92d5c52aaac0fa8e58b92e96bf2025d6848a2845
Author: Martin Sebor <msebor@redhat.com>
Date: Mon Oct 11 09:36:57 2021 -0600
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)
Diff:
---
resolv/res_query.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-12 6:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 6:21 [glibc/release/2.34/master] resolv: Avoid GCC 12 false positive warning [BZ #28439] Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).