aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-04-20 19:40:13 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-04-20 19:40:13 +0000
commitc0c47ffe49a70fb77831194f625f593bd29c449e (patch)
treedb8c1dbd3c3052a39baeff9ada43ecce15282496 /roff.c
parent29cecee7ff6894517a32d929aecee283bb85058c (diff)
downloadmandoc-c0c47ffe49a70fb77831194f625f593bd29c449e.tar.gz
mandoc-c0c47ffe49a70fb77831194f625f593bd29c449e.tar.zst
mandoc-c0c47ffe49a70fb77831194f625f593bd29c449e.zip
make sure static buffers for snprintf(3) are large enough
and cast snprintf return value to (void) where they are
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/roff.c b/roff.c
index 5ea64e20..fee1a8c1 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.207 2014/04/20 16:46:05 schwarze Exp $ */
+/* $Id: roff.c,v 1.208 2014/04/20 19:40:13 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -488,7 +488,7 @@ roff_alloc(struct mparse *parse, int options)
static enum rofferr
roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos)
{
- char ubuf[12]; /* buffer to print the number */
+ char ubuf[24]; /* buffer to print the number */
const char *start; /* start of the string to process */
const char *stesc; /* start of an escape sequence ('\\') */
const char *stnam; /* start of the name, after "[(*" */
@@ -614,11 +614,11 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos)
ubuf[1] = '\0';
break;
case 'n':
- snprintf(ubuf, sizeof(ubuf), "%d",
+ (void)snprintf(ubuf, sizeof(ubuf), "%d",
roff_getregn(r, stnam, naml));
break;
case 'w':
- snprintf(ubuf, sizeof(ubuf), "%d",
+ (void)snprintf(ubuf, sizeof(ubuf), "%d",
24 * (int)naml);
break;
}