diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-11-18 20:46:48 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-11-18 20:46:48 +0000 |
commit | 323c41ca9bc0986dc2a83bb659368c38dfaf02e1 (patch) | |
tree | a9b4c1916f2d76320f7726b8e120ced7f8a095f6 /gnu/usr.bin/groff/pic | |
parent | e14083d4ddfd218f41de29932814531200331787 (diff) |
More printf format paranoia; noticed by David Krause
Diffstat (limited to 'gnu/usr.bin/groff/pic')
-rw-r--r-- | gnu/usr.bin/groff/pic/pic.y | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gnu/usr.bin/groff/pic/pic.y b/gnu/usr.bin/groff/pic/pic.y index 4d5a35440d3..d0420acd793 100644 --- a/gnu/usr.bin/groff/pic/pic.y +++ b/gnu/usr.bin/groff/pic/pic.y @@ -1758,18 +1758,20 @@ char *do_sprintf(const char *form, const double *v, int nv) if (*form == '%') { one_format += *form++; one_format += '\0'; - snprintf(sprintf_buf, sizeof(sprintf_buf), one_format.contents()); + snprintf(sprintf_buf, sizeof(sprintf_buf), + "%s", one_format.contents()); } else { if (i >= nv) { - lex_error("too few arguments to sprintf"); + lex_error("too few arguments to snprintf"); result += one_format; result += form; break; } one_format += *form++; one_format += '\0'; - snprintf(sprintf_buf, sizeof(sprintf_buf), one_format.contents(), v[i++]); + snprintf(sprintf_buf, sizeof(sprintf_buf), + one_format.contents(), v[i++]); } one_format.clear(); result += sprintf_buf; |