From: Andreas Krebbel Date: Mon, 18 Dec 2017 11:31:06 +0000 (+0000) Subject: S/390: PR83420: Improve hotpatch option parsing. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4aeba1b7659603e49b8edfc0d64aa7790d2ef3fe;p=gcc.git S/390: PR83420: Improve hotpatch option parsing. 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 PR target/83420 * config/s390/s390.c (s390_option_override): Avoid strncpy. From-SVN: r255777 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ab682443d3a..128374c1287 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-12-18 Andreas Krebbel + + PR target/83420 + * config/s390/s390.c (s390_option_override): Avoid strncpy. + 2017-12-18 Richard Biener PR tree-optimization/81877 diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 0b04ac026fb..6f2a1895f91 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); }