[binutils-gdb] demand_copy_C_string NUL check
Alan Modra
amodra@sourceware.org
Tue Feb 16 09:07:41 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=70433886683b67b5a28abe35eac7e9ab82a4a9e4
commit 70433886683b67b5a28abe35eac7e9ab82a4a9e4
Author: Alan Modra <amodra@gmail.com>
Date: Tue Feb 16 14:32:36 2021 +1030
demand_copy_C_string NUL check
* read.c (demand_copy_C_string): Really check for embedded zeros.
Diff:
---
gas/ChangeLog | 4 ++++
gas/read.c | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 9c6fe109d92..f4c9d0a0fa6 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 ede811b0a03..3e760653289 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;
}
}
}
More information about the Binutils-cvs
mailing list