bug fix, invalid read when the title line is the empty
This commit is contained in:
parent
2506fe3858
commit
f52ae6eccd
|
|
@ -939,7 +939,14 @@ inp_dodeck(
|
|||
} // if (!noparse) . . .
|
||||
|
||||
/* add title of deck to data base */
|
||||
/* this won't work if the title is the empty string
|
||||
* cp_addkword() doesn't work for tt === ""
|
||||
* since CT_CKTNAMES doesn't seem to be used anywhere
|
||||
* I've disabled this piece.
|
||||
*/
|
||||
#if 0
|
||||
cp_addkword(CT_CKTNAMES, tt);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -599,6 +599,10 @@ clookup(register char *word, struct ccom **dd, bool pref, bool create)
|
|||
buf[0] = *word;
|
||||
buf[1] = '\0';
|
||||
place->cc_name = copy(buf);
|
||||
if (word[0] == '\0') {
|
||||
fprintf(stderr, "ERROR, internal error, clookup() needs fixing to process the empty string\n");
|
||||
controlled_exit(EXIT_FAILURE);
|
||||
}
|
||||
if (word[1])
|
||||
place->cc_invalid = 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue