segmentation fault caused by new getstrtoken semantics

Conflicts:
	src/laws.c
This commit is contained in:
Enno Rehling 2014-08-24 12:40:00 +02:00
parent 87720c2b9c
commit 2246ce9d7a
2 changed files with 9 additions and 6 deletions

View File

@ -2768,7 +2768,7 @@ static void breed_cmd(unit * u, struct order *ord)
skip_token();
s = getstrtoken();
m = atoi((const char *)s);
m = s ? atoi((const char *)s) : 0;
if (m != 0) {
/* first came a want-paramter */
s = getstrtoken();

View File

@ -3942,11 +3942,14 @@ void defaultorders(void)
order *ord = *ordp;
if (getkeyword(ord) == K_DEFAULT) {
char lbuf[8192];
order *new_order;
init_tokens(ord);
skip_token(); /* skip the keyword */
strcpy(lbuf, getstrtoken());
order *new_order = 0;
const char *s;
init_order(ord);
s = getstrtoken();
if (s) {
strcpy(lbuf, s);
new_order = parse_order(lbuf, u->faction->locale);
}
*ordp = ord->next;
ord->next = NULL;
free_order(ord);