]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* config/tc-d10v.c (do_assemble): Correctly detect overflow of
authorAlan Modra <amodra@gmail.com>
Wed, 25 Aug 2010 11:51:07 +0000 (11:51 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 25 Aug 2010 11:51:07 +0000 (11:51 +0000)
"name" buffer.
* config/tc-m68hc11.c (md_assemble): Likewise.
* config/tc-microblaze.c (md_assemble): Likewise.  Correct cast
of is_end_of_line index.

gas/ChangeLog
gas/config/tc-d10v.c
gas/config/tc-m68hc11.c
gas/config/tc-microblaze.c

index f54691158d7238f3bdc8ffde5bfc818f6d5a6535..3f4d9d2b5b0e780dd81495e13d7e2a999a4bba9b 100644 (file)
@@ -1,3 +1,11 @@
+2010-08-25  Alan Modra  <amodra@gmail.com>
+
+       * config/tc-d10v.c (do_assemble): Correctly detect overflow of
+       "name" buffer.
+       * config/tc-m68hc11.c (md_assemble): Likewise.
+       * config/tc-microblaze.c (md_assemble): Likewise.  Correct cast
+       of is_end_of_line index.
+
 2010-08-25  Jie Zhang  <jie@codesourcery.com>
 
        * config/tc-arm.c (encode_arm_addr_mode_2): Fix comment.
index d0c312986da504eedb7ce8375f77d52f37a9bf20..8ba4f30edc6302b494b150050383abd81c7fb4cb 100644 (file)
@@ -1,6 +1,6 @@
 /* tc-d10v.c -- Assembler code for the Mitsubishi D10V
    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
-   2007, 2009
+   2007, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -1420,11 +1420,13 @@ do_assemble (char *str, struct d10v_opcode **opcode)
 
   /* Find the opcode end.  */
   for (op_start = op_end = (unsigned char *) str;
-       *op_end && nlen < 20 && !is_end_of_line[*op_end] && *op_end != ' ';
+       *op_end && !is_end_of_line[*op_end] && *op_end != ' ';
        op_end++)
     {
       name[nlen] = TOLOWER (op_start[nlen]);
       nlen++;
+      if (nlen == sizeof (name) - 1)
+       break;
     }
   name[nlen] = 0;
 
index c31496191d67f731c95029b6df037d0d3a6df7b0..2e328ea77b06db9fe2a8f7b070b4c35fd068b459 100644 (file)
@@ -2403,11 +2403,13 @@ md_assemble (char *str)
   /* Find the opcode end and get the opcode in 'name'.  The opcode is forced
      lower case (the opcode table only has lower case op-codes).  */
   for (op_start = op_end = (unsigned char *) str;
-       *op_end && nlen < 20 && !is_end_of_line[*op_end] && *op_end != ' ';
+       *op_end && !is_end_of_line[*op_end] && *op_end != ' ';
        op_end++)
     {
       name[nlen] = TOLOWER (op_start[nlen]);
       nlen++;
+      if (nlen == sizeof (name) - 1)
+       break;
     }
   name[nlen] = 0;
 
index e1c4953d3a6376825f469e1f5ee607bf1144e028..7c6357e8e88007a0e71c31d35573b3588a2086df 100644 (file)
@@ -807,11 +807,13 @@ md_assemble (char * str)
 
   /* Find the op code end.  */
   for (op_start = op_end = str;
-       * op_end && nlen < 20 && !is_end_of_line [(int)*op_end] && *op_end != ' ';
+       *op_end && !is_end_of_line[(unsigned char) *op_end] && *op_end != ' ';
        op_end++)
     {
       name[nlen] = op_start[nlen];
       nlen++;
+      if (nlen == sizeof (name) - 1)
+       break;
     }
 
   name [nlen] = 0;