* genmacro.c (main): Incorporate slightly modified version of David

Woodhouse's fix of a memory corruption bug when the string is empty.

Source: https://www.redhat.com/archives/fedora-extras-commits/2005-February/msg00305.html

svn path=/trunk/yasm/; revision=1206
0.5.0rc2
Peter Johnson 20 years ago
parent a67496706c
commit f213c34e6a
  1. 4
      modules/preprocs/nasm/genmacro.c

@ -102,8 +102,8 @@ main(int argc, char *argv[])
while (*strp == ' ' || *strp == '\t')
strp++;
len = strlen(strp);
while (strp[len-1] == ' ' || strp[len-1] == '\t' ||
strp[len-1] == '\n') {
while (len > 0 && (strp[len-1] == ' ' || strp[len-1] == '\t' ||
strp[len-1] == '\n')) {
strp[len-1] = '\0';
len--;
}

Loading…
Cancel
Save