diff --git a/src/mkmaze.c b/src/mkmaze.c index ea1ebdae4..ae0961413 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -974,20 +974,24 @@ makemaz(const char *s) if (*s) { if (sp && sp->rndlevs) - Sprintf(protofile, "%s-%d", s, rnd((int) sp->rndlevs)); + Snprintf(protofile, sizeof protofile, + "%s-%d", s, rnd((int) sp->rndlevs)); else Strcpy(protofile, s); } else if (*(g.dungeons[u.uz.dnum].proto)) { if (dunlevs_in_dungeon(&u.uz) > 1) { if (sp && sp->rndlevs) - Sprintf(protofile, "%s%d-%d", g.dungeons[u.uz.dnum].proto, - dunlev(&u.uz), rnd((int) sp->rndlevs)); + Snprintf(protofile, sizeof protofile, + "%s%d-%d", g.dungeons[u.uz.dnum].proto, + dunlev(&u.uz), rnd((int) sp->rndlevs)); else - Sprintf(protofile, "%s%d", g.dungeons[u.uz.dnum].proto, - dunlev(&u.uz)); + Snprintf(protofile, sizeof protofile, + "%s%d", g.dungeons[u.uz.dnum].proto, + dunlev(&u.uz)); } else if (sp && sp->rndlevs) { - Sprintf(protofile, "%s-%d", g.dungeons[u.uz.dnum].proto, - rnd((int) sp->rndlevs)); + Snprintf(protofile, sizeof protofile, + "%s-%d", g.dungeons[u.uz.dnum].proto, + rnd((int) sp->rndlevs)); } else Strcpy(protofile, g.dungeons[u.uz.dnum].proto); diff --git a/win/Qt/qt_menu.cpp b/win/Qt/qt_menu.cpp index 7a4eefee2..bc6810b0f 100644 --- a/win/Qt/qt_menu.cpp +++ b/win/Qt/qt_menu.cpp @@ -1058,7 +1058,7 @@ void NetHackQtTextWindow::UseRIP(int how, time_t when) char buf[BUFSZ]; char *dpx; - int line; + int line, snpres; /* Put name on stone */ (void) snprintf(rip_line[NAME_LINE], STONE_LINE_LEN + 1, @@ -1079,8 +1079,8 @@ void NetHackQtTextWindow::UseRIP(int how, time_t when) it's arbitrary but still way, way more than could ever be needed */ if (cash > 999999999L) cash = 999999999L; - (void) snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN + 1, "%ld Au", cash); - + snpres = snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN + 1, "%ld Au", cash); + nhUse(snpres); /* Put together death description */ formatkiller(buf, sizeof buf, how, FALSE); //str_copy(buf, killer, SIZE(buf));