Skip to content

Commit af58e6c

Browse files
committed
Fix: archfiend bribe() could get called when hero had no gold
Fuzzer identified an edge case that fell through the cracks and hit the impossible in money2mon: if an archfiend demanded at least one item from you and you turned it over, then had no cash, it would attempt to get a bribe and transfer 0 zorkmids to the monster. It doesn't appear that bribe is intended to be called with 0 gold since vanilla checks for this everywhere it's called. So I didn't add any guard case into bribe() itself; the fix is just to insert an additional pline noting you have no money instead of calling bribe().
1 parent d29707c commit af58e6c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/minion.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,11 @@ demon_talk(struct monst *mtmp)
523523
else if (canseemon(mtmp))
524524
pline("%s seems to be demanding your money.", Amonnam(mtmp));
525525

526-
offer = bribe(mtmp);
526+
if (cash < 1)
527+
pline("But you have no money.");
528+
else
529+
offer = bribe(mtmp);
530+
527531
if (offer >= demand) {
528532
verbalize("Very well, mortal. I shall not impede thy quest.");
529533
pline("%s vanishes, laughing about cowardly mortals.",

0 commit comments

Comments
 (0)