(prmptrd, uprmptrd): Oops on null prompt. getstarg() is sometimes
called with a null prompt when it is believed not to use it, and that belief is sometimes wrong. Other users could have similar bugs. Some systems (GNU, Windows) deal gracefully with printing null strings, others crash.
This commit is contained in:
parent
93b6a54356
commit
ee53725a21
1 changed files with 6 additions and 0 deletions
|
@ -367,6 +367,9 @@ prmptrd(char *prompt, char *buf, int size)
|
||||||
*/
|
*/
|
||||||
CANT_HAPPEN(player->aborted);
|
CANT_HAPPEN(player->aborted);
|
||||||
|
|
||||||
|
if (CANT_HAPPEN(!prompt))
|
||||||
|
prompt = "? ";
|
||||||
|
|
||||||
pr_id(player, C_FLUSH, "%s\n", prompt);
|
pr_id(player, C_FLUSH, "%s\n", prompt);
|
||||||
if ((r = recvclient(buf, size)) < 0)
|
if ((r = recvclient(buf, size)) < 0)
|
||||||
return r;
|
return r;
|
||||||
|
@ -396,6 +399,9 @@ uprmptrd(char *prompt, char *buf, int size)
|
||||||
/* See prmptrd() */
|
/* See prmptrd() */
|
||||||
CANT_HAPPEN(player->aborted);
|
CANT_HAPPEN(player->aborted);
|
||||||
|
|
||||||
|
if (CANT_HAPPEN(!prompt))
|
||||||
|
prompt = "? ";
|
||||||
|
|
||||||
pr_id(player, C_FLUSH, "%s\n", prompt);
|
pr_id(player, C_FLUSH, "%s\n", prompt);
|
||||||
if ((r = recvclient(buf, size)) < 0)
|
if ((r = recvclient(buf, size)) < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue