Fix bad string handling in makeBpt.

This behaved badly when confronted with windows CR+LF end of lines.
Using fgets() left a stray CR at the end of the returned string.
This commit is contained in:
Michael Davidsaver
2010-06-22 11:43:42 -05:00
committed by Andrew Johnson
parent 78fc4cbcf7
commit 320ff29c4a

View File

@@ -144,12 +144,13 @@ int main(int argc, char **argv)
if(*pend!='"') errExit("Illegal Header");
len = pend - pbeg;
if(len<=1) errExit("Illegal Header");
pname = calloc(len,sizeof(char));
pname = calloc(len+1,sizeof(char));
if(!pname) {
fprintf(stderr,"calloc failed while processing line %d\n",linenum);
exit(-1);
}
strncpy(pname,pbeg,len);
pname[len]='\0';
pbeg = pend + 1;
if(getNumber(&pbeg,&value)) errExit("Illegal Header");
brkCreateInfo.engLow = value;