nds32: __builtin_strncpy bound equals destination size
authorAlan Modra <amodra@gmail.com>
Wed, 26 May 2021 12:53:44 +0000 (22:23 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 27 May 2021 01:14:31 +0000 (10:44 +0930)
* config/tc-nds32.c (do_pseudo_push_bhwd, do_pseudo_pop_bhwd),
(do_pseudo_pusha, do_pseudo_pushi): Avoid fortify strncpy bound
error.

gas/ChangeLog
gas/config/tc-nds32.c

index 31f9e36ce9a4f2603d54833e8a6c719ea66dcff3..d2f5f7643871a1c8443e494c946e3c4bcf73c52b 100644 (file)
@@ -1,3 +1,9 @@
+2021-05-27  Alan Modra  <amodra@gmail.com>
+
+       * config/tc-nds32.c (do_pseudo_push_bhwd, do_pseudo_pop_bhwd),
+       (do_pseudo_pusha, do_pseudo_pushi): Avoid fortify strncpy bound
+       error.
+
 2021-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/27905
index e5c0eaf0866819ea15febff47f1d96b414aacc41..c5bad6b476a6df38035c3ad385ebdb3794809517 100644 (file)
@@ -3255,8 +3255,8 @@ do_pseudo_push_bhwd (int argc ATTRIBUTE_UNUSED, char *argv[],
 
   if (argc == 2)
     {
-      strncpy (location, argv[1], 8);
-      location[7] = '\0';
+      strncpy (location, argv[1], sizeof (location) - 1);
+      location[sizeof (location) - 1] = '\0';
     }
 
   md_assemblef ("l.%c $ta,%s", size, argv[0]);
@@ -3287,8 +3287,8 @@ do_pseudo_pop_bhwd (int argc ATTRIBUTE_UNUSED, char *argv[],
 
   if (argc == 3)
     {
-      strncpy (location, argv[2], 8);
-      location[7] = '\0';
+      strncpy (location, argv[2], sizeof (location) - 1);
+      location[sizeof (location) - 1] = '\0';
     }
 
   if ((pv & 0x3) == 0x3) /* double-word */
@@ -3310,8 +3310,8 @@ do_pseudo_pusha (int argc ATTRIBUTE_UNUSED, char *argv[],
 
   if (argc == 2)
     {
-      strncpy (location, argv[1], 8);
-      location[7] = '\0';
+      strncpy (location, argv[1], sizeof (location) - 1);
+      location[sizeof (location) - 1] = '\0';
     }
 
   md_assemblef ("la $ta,%s", argv[0]);
@@ -3327,8 +3327,8 @@ do_pseudo_pushi (int argc ATTRIBUTE_UNUSED, char *argv[],
 
   if (argc == 2)
     {
-      strncpy (location, argv[1], 8);
-      location[7] = '\0';
+      strncpy (location, argv[1], sizeof (location) - 1);
+      location[sizeof (location) - 1] = '\0';
     }
 
   md_assemblef ("li $ta,%s", argv[0]);
This page took 0.075192 seconds and 4 git commands to generate.