aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-02-16 14:32:36 +1030
committerAlan Modra <amodra@gmail.com>2021-02-16 14:40:14 +1030
commit70433886683b67b5a28abe35eac7e9ab82a4a9e4 (patch)
tree39c7ca3c4f23a60dfe49c30f602c801fd2aace50 /gas
parent94ae6062ab254d1d057514ed1c78becf6efa5802 (diff)
downloadgdb-70433886683b67b5a28abe35eac7e9ab82a4a9e4.zip
gdb-70433886683b67b5a28abe35eac7e9ab82a4a9e4.tar.gz
gdb-70433886683b67b5a28abe35eac7e9ab82a4a9e4.tar.bz2
demand_copy_C_string NUL check
* read.c (demand_copy_C_string): Really check for embedded zeros.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/read.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 9c6fe10..f4c9d0a 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2021-02-16 Alan Modra <amodra@gmail.com>
+
+ * read.c (demand_copy_C_string): Really check for embedded zeros.
+
2021-02-15 Andreas Krebbel <krebbel@linux.ibm.com>
* config/tc-s390.c (s390_parse_cpu): New entry for arch14.
diff --git a/gas/read.c b/gas/read.c
index ede811b..3e76065 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -5743,12 +5743,12 @@ demand_copy_C_string (int *len_pointer)
for (len = *len_pointer; len > 0; len--)
{
- if (*s == 0)
+ if (s[len - 1] == 0)
{
s = 0;
- len = 1;
*len_pointer = 0;
as_bad (_("this string may not contain \'\\0\'"));
+ break;
}
}
}