From e1bb09be17d41880b391cdcbe9d968f8964928ff Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 23 Apr 2014 16:08:33 +0000 Subject: Audit strlcpy(3)/strlcat(3) usage. * Repair three instances of silent truncation, use asprintf(3). * Change two instances of strlen(3)+malloc(3)+strlcpy(3)+strlcat(3)+... to use asprintf(3) instead to make them less error prone. * Cast the return value of four instances where the destination buffer is known to be large enough to (void). * Completely remove three useless instances of strlcpy(3)/strlcat(3). * Mark two places in -Thtml with XXX that can cause information loss and crashes but are not easy to fix, requiring design changes of some internal interfaces. * The file mandocdb.c remains to be audited. --- tbl_data.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tbl_data.c') diff --git a/tbl_data.c b/tbl_data.c index 2a362e5c..1db24a61 100644 --- a/tbl_data.c +++ b/tbl_data.c @@ -1,4 +1,4 @@ -/* $Id: tbl_data.c,v 1.30 2014/04/20 16:46:05 schwarze Exp $ */ +/* $Id: tbl_data.c,v 1.31 2014/04/23 16:08:33 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -167,8 +167,8 @@ tbl_cdata(struct tbl_node *tbl, int ln, const char *p) if (dat->string) { sz = strlen(p) + strlen(dat->string) + 2; dat->string = mandoc_realloc(dat->string, sz); - strlcat(dat->string, " ", sz); - strlcat(dat->string, p, sz); + (void)strlcat(dat->string, " ", sz); + (void)strlcat(dat->string, p, sz); } else dat->string = mandoc_strdup(p); -- cgit v1.2.3-56-ge451