diff options
author | Alan Modra <amodra@gmail.com> | 2021-05-26 22:23:44 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-05-27 10:44:31 +0930 |
commit | badf836a0c727608d7660949bf353525ee2d8252 (patch) | |
tree | e434eeefbf15a1df433c216cb64be90bfce539e8 /gas | |
parent | cc37fec878169f9209684a61789af89850c99395 (diff) | |
download | binutils-badf836a0c727608d7660949bf353525ee2d8252.zip binutils-badf836a0c727608d7660949bf353525ee2d8252.tar.gz binutils-badf836a0c727608d7660949bf353525ee2d8252.tar.bz2 |
nds32: __builtin_strncpy bound equals destination size
* config/tc-nds32.c (do_pseudo_push_bhwd, do_pseudo_pop_bhwd),
(do_pseudo_pusha, do_pseudo_pushi): Avoid fortify strncpy bound
error.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 6 | ||||
-rw-r--r-- | gas/config/tc-nds32.c | 16 |
2 files changed, 14 insertions, 8 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 31f9e36..d2f5f76 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -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 diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c index e5c0eaf..c5bad6b4 100644 --- a/gas/config/tc-nds32.c +++ b/gas/config/tc-nds32.c @@ -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]); |