commit 0f2cb2792bc4b51ec4bd7ea4d90a6e572bd78860
parent d72d86eb7ab39320fcd33642458862aff84bdc3b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 May 2015 10:35:57 +0200
Add additional @ in defines
We need something that limits the numeric arrays,
because in other case we depend of the user trying
to do fancy things to get a segmentation fault.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cc1/cpp.c b/cc1/cpp.c
@@ -69,7 +69,7 @@ copydefine(char *s, char *args[], char *buff, int bufsiz, int nargs)
{
unsigned ncopy, n;
size_t len;
- char arroba[5], *par, *endp, **bp;
+ char arroba[6], *par, *endp, **bp;
while (*s && bufsiz > 0) {
if (!isalnum(*s) && *s != '_') {
@@ -86,13 +86,13 @@ copydefine(char *s, char *args[], char *buff, int bufsiz, int nargs)
for (bp =args, n = 0; n < nargs; ++bp, n++) {
if (strncmp(s, *bp, len))
continue;
- sprintf(arroba, "@%02d", n);
+ sprintf(arroba, "@%02d@", n);
break;
}
if (n == nargs)
par = s, ncopy = len;
else
- par = arroba, ncopy = 3;
+ par = arroba, ncopy = 4;
if ((bufsiz -= ncopy) < 0)
goto too_long;