210 |
|
goto badformat; |
211 |
|
if (hdr->isWEA) { /* getting WEA header */ |
212 |
|
cp = linbuf+6; |
213 |
< |
if (sscanf(cp, "%[^_]_%[^\r\n]q", |
214 |
< |
hdr->loc.city, hdr->loc.country) != 2) |
213 |
> |
if (sscanf(cp, "%[^_]_%[^\r\n]", |
214 |
> |
hdr->loc.city, hdr->loc.country) < 1) |
215 |
|
goto badformat; |
216 |
|
if (!fgets(linbuf, sizeof(linbuf), hdr->fp)) |
217 |
|
goto readerr; |
295 |
|
hdr->comments1 = (char *)malloc(n); |
296 |
|
if (hdr->comments1 == NULL) |
297 |
|
goto memerr; |
298 |
< |
memcpy(hdr->comments1, linbuf+11, n); |
299 |
< |
hdr->comments1[n] = '\0'; |
298 |
> |
memcpy(hdr->comments1, linbuf+11, n-1); |
299 |
> |
hdr->comments1[n-1] = '\0'; |
300 |
|
} |
301 |
|
if (!fgets(linbuf, sizeof(linbuf), hdr->fp)) |
302 |
|
goto readerr; |
308 |
|
hdr->comments2 = (char *)malloc(n); |
309 |
|
if (hdr->comments2 == NULL) |
310 |
|
goto memerr; |
311 |
< |
memcpy(hdr->comments2, linbuf+11, n); |
312 |
< |
hdr->comments2[n] = '\0'; |
311 |
> |
memcpy(hdr->comments2, linbuf+11, n-1); |
312 |
> |
hdr->comments2[n-1] = '\0'; |
313 |
|
} |
314 |
|
if (!fgets(linbuf, sizeof(linbuf), hdr->fp)) |
315 |
|
goto readerr; |