yasm/yasm-0.4.0-genmacro.patch
David Woodhouse c07b972046 Fix memory corruption in genmacro. If the string is empty, don't start
screwing with stuff at str[strlen(str)-1].
2005-02-14 09:27:35 +00:00

14 lines
495 B
Diff

--- yasm-0.4.0/modules/preprocs/nasm/genmacro.c~ 2004-10-31 03:55:54.000000000 +0000
+++ yasm-0.4.0/modules/preprocs/nasm/genmacro.c 2005-02-14 09:21:37.000000000 +0000
@@ -102,8 +102,8 @@
while (*strp == ' ' || *strp == '\t')
strp++;
len = strlen(strp);
- while (strp[len-1] == ' ' || strp[len-1] == '\t' ||
- strp[len-1] == '\n') {
+ while (len && (strp[len-1] == ' ' || strp[len-1] == '\t' ||
+ strp[len-1] == '\n')) {
strp[len-1] = '\0';
len--;
}