SHA256
1
0
forked from pool/make
make/make-fix_whitespace_tokenization.diff
Matthias Hopf 28dc1ff7e8 - make-fix_whitespace_tokenization.diff
Fix Savannah bug #33125 (bnc #681108):
  Memory corruption during build of android build system.

OBS-URL: https://build.opensuse.org/package/show/Base:System/make?expand=0&rev=15
2011-04-19 15:24:31 +00:00

31 lines
675 B
Diff

Index: make-3.82/function.c
===================================================================
--- make-3.82.orig/function.c
+++ make-3.82/function.c
@@ -1133,19 +1133,14 @@ func_sort (char *o, char **argv, const c
/* Find the maximum number of words we'll have. */
t = argv[0];
- wordi = 1;
- while (*t != '\0')
+ wordi = 0;
+ while ((p = find_next_token (&t, &len)) != 0)
{
- char c = *(t++);
-
- if (! isspace ((unsigned char)c))
- continue;
-
- ++wordi;
-
- while (isspace ((unsigned char)*t))
- ++t;
+ ++t;
+ wordi++;
}
+ if (! wordi)
+ wordi = 1;
words = xmalloc (wordi * sizeof (char *));