1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00

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.
This commit is contained in:
Martin Sebor
2021-10-11 09:36:57 -06:00
parent 5d26d12f4a
commit eb73b87897

View File

@@ -610,7 +610,9 @@ __res_context_querydomain (struct resolv_context *ctx,
RES_SET_H_ERRNO(statp, NO_RECOVERY); RES_SET_H_ERRNO(statp, NO_RECOVERY);
return (-1); 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, return __res_context_query (ctx, longname, class, type, answer,
anslen, answerp, answerp2, nanswerp2, anslen, answerp, answerp2, nanswerp2,