diff options
author | Stu Grossman <grossman@babylon-5.cygnus.com> | 1999-05-17 00:44:09 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1999-05-16 18:44:09 -0600 |
commit | 53504016e143103699fd8722de9bf0aacab61b02 (patch) | |
tree | cfb9111185284ec86eea5dc7777f4ae27bca7706 /libiberty | |
parent | 51e2a951cc3abdf9a9118f8897d4ca8d76776579 (diff) | |
download | gcc-53504016e143103699fd8722de9bf0aacab61b02.zip gcc-53504016e143103699fd8722de9bf0aacab61b02.tar.gz gcc-53504016e143103699fd8722de9bf0aacab61b02.tar.bz2 |
cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance the *mangled pointer beyond the end of the string.
* cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance
the *mangled pointer beyond the end of the string. Clean up code to
match prevailing coding style.
From-SVN: r26959
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 6 | ||||
-rw-r--r-- | libiberty/cplus-dem.c | 14 |
2 files changed, 14 insertions, 6 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index f5e0928..caf12de 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +Mon May 17 01:42:34 1999 Stu Grossman <grossman@babylon-5.cygnus.com> + + * cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance + the *mangled pointer beyond the end of the string. Clean up code to + match prevailing coding style. + 1999-05-13 Michael Hayes <m.hayes@elec.canterbury.ac.nz> * tmpnam.c (L_tmpnam): Fix typo. diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 706d929..6d51710 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -51,6 +51,8 @@ char * realloc (); #include "libiberty.h" +#define min(X,Y) (((X) < (Y)) ? (X) : (Y)) + static const char *mystrstr PARAMS ((const char *, const char *)); static const char * @@ -3373,14 +3375,14 @@ demangle_fund_type (work, mangled, result) break; } case 'I': - ++(*mangled); + (*mangled)++; if (**mangled == '_') { int i; - ++(*mangled); + (*mangled)++; for (i = 0; - (i < sizeof (buf) - 1 && **mangled && **mangled != '_'); - ++(*mangled), ++i) + i < sizeof (buf) - 1 && **mangled && **mangled != '_'; + (*mangled)++, i++) buf[i] = **mangled; if (**mangled != '_') { @@ -3388,13 +3390,13 @@ demangle_fund_type (work, mangled, result) break; } buf[i] = '\0'; - ++(*mangled); + (*mangled)++; } else { strncpy (buf, *mangled, 2); buf[2] = '\0'; - *mangled += 2; + *mangled += min (strlen (*mangled), 2); } sscanf (buf, "%x", &dec); sprintf (buf, "int%i_t", dec); |