From cd41a42c4b2e94544cb9ada528f59d696a0131b0 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sat, 8 Oct 2016 17:38:37 -0400 Subject: Fix jrp prompt snprintf --- .bin/jrp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.bin/jrp.c b/.bin/jrp.c index a7f71180..0c6b18f1 100755 --- a/.bin/jrp.c +++ b/.bin/jrp.c @@ -183,11 +183,12 @@ static char *prompt(EditLine *el __attribute((unused))) { static char buf[4096]; char *bp = buf; for (value *sp = stack.limit - 1; sp >= stack.ptr; --sp) { + size_t len = sizeof(buf) - (buf - bp) - 2; switch (radix) { - case 2: bp += snprintf(bp, buf - bp - 2, " %s", fmt_bin(*sp)); break; - case 8: bp += snprintf(bp, buf - bp - 2, " %llo", *sp); break; - case 10: bp += snprintf(bp, buf - bp - 2, " %lld", *sp); break; - case 16: bp += snprintf(bp, buf - bp - 2, " %llx", *sp); break; + case 2: bp += snprintf(bp, len, " %s", fmt_bin(*sp)); break; + case 8: bp += snprintf(bp, len, " %llo", *sp); break; + case 10: bp += snprintf(bp, len, " %lld", *sp); break; + case 16: bp += snprintf(bp, len, " %llx", *sp); break; } } buf[0] = '['; -- cgit 1.4.1 bc575f6d79370940f&follow=1'>commit diff
path: root/bin/Makefile (unfollow)
Commit message (Expand)Author
2019-02-17Generate HTML with hi -n -f html -o anchorJune McEnroe
2019-02-17Add hi -f html -o anchor for line number linksJune McEnroe
2019-02-17Simplify temp trap in upJune McEnroe
2019-02-17Add line numbers to hiJune McEnroe
2019-02-17Always split spans after newlinesJune McEnroe
2019-02-15Color format specifiers light cyan in vimJune McEnroe
2019-02-15Highlight Interp as yellowJune McEnroe
2019-02-15Highlight strings in sh command substitutionsJune McEnroe
2019-02-15Add nmap gpJune McEnroe
2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe
2019-02-13Add forgotten "sixth" book of H2G2June McEnroe