[Committed] S/390: PR83420: Improve hotpatch option parsing.
Andreas Krebbel
krebbel@linux.vnet.ibm.com
Mon Dec 18 11:33:00 GMT 2017
With the attached patch we get rid of the following build failure:
/home/andreas/build/../gcc/gcc/config/s390/s390.c: In function âvoid
s390_option_override()â:
/home/andreas/build/../gcc/gcc/config/s390/s390.c:15361:16: error: âchar*
strncpy(char*, const char*, size_t)â specified bound 256 equals destination
size [-Werror=stringop-truncation]
strncpy (s, opt->arg, 256);
~~~~~~~~^~~~~~~~~~~~~~~~~~
gcc/ChangeLog:
2017-12-18 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
PR target/83420
* config/s390/s390.c (s390_option_override): Avoid strncpy.
---
gcc/config/s390/s390.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 0b04ac0..6f2a189 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -15357,16 +15357,11 @@ s390_option_override (void)
{
int val1;
int val2;
- char s[256];
- char *t;
+ char *s = strtok (ASTRDUP (opt->arg), ",");
+ char *t = strtok (NULL, "\0");
- strncpy (s, opt->arg, 256);
- s[255] = 0;
- t = strchr (s, ',');
if (t != NULL)
{
- *t = 0;
- t++;
val1 = integral_argument (s);
val2 = integral_argument (t);
}
--
2.9.1
More information about the Gcc-patches
mailing list