INN commit: trunk (4 files)
INN Commit
rra at isc.org
Sat Jun 3 14:16:59 UTC 2017
Date: Saturday, June 3, 2017 @ 07:16:58
Author: iulius
Revision: 10146
Fix new format-truncation warning in GCC 7
A few strings in innfeed status and in Sender/Injection-Info
header fields may have been truncated when generated. The case
is rare, though (240 bytes for instance in the username and
hostname).
Modified:
trunk/innfeed/host.c
trunk/innfeed/innlistener.c
trunk/nnrpd/post.c
trunk/storage/cnfs/cnfs.c
-----------------------+
innfeed/host.c | 6 +++---
innfeed/innlistener.c | 3 ++-
nnrpd/post.c | 4 ++--
storage/cnfs/cnfs.c | 3 ++-
4 files changed, 9 insertions(+), 7 deletions(-)
Modified: innfeed/host.c
===================================================================
--- innfeed/host.c 2017-05-29 20:22:53 UTC (rev 10145)
+++ innfeed/host.c 2017-06-03 14:16:58 UTC (rev 10146)
@@ -3473,7 +3473,7 @@
double cnt = (host->blCount) ? (host->blCount) : 1.0;
double size;
char *tsize;
- char buf[]="1234.1 MB";
+ char buf[]="1.23e+5 TB"; /* usual length is shorter, like "12.3 MB" */
ASSERT (host != NULL) ;
ASSERT (fp != NULL) ;
@@ -3580,12 +3580,12 @@
(double) host->gCxnQueue / (host->gArtsOffered ? host->gArtsOffered :1) ,
100.0 * host->blFull / cnt) ;
size=convsize(host->gArtsSizeAccepted, &tsize);
- snprintf(buf,sizeof(buf),"%.3g %s", size, tsize);
+ snprintf(buf, sizeof(buf), "%.3g %s", size, tsize);
fprintf (fp, "accpt size: %-8s drop-deferred: %-5s defer length: %-3.1f\n",
buf, host->params->dropDeferred ? "true " : "false",
(double)host->dlAccum / cnt) ;
size=convsize(host->gArtsSizeRejected, &tsize);
- snprintf(buf,sizeof(buf),"%.3g %s", size, tsize);
+ snprintf(buf, sizeof(buf), "%.3g %s", size, tsize);
fprintf (fp, "rejct size: %-8s min-queue-cxn: %s\n",
buf, host->params->minQueueCxn ? "true " : "false");
Modified: innfeed/innlistener.c
===================================================================
--- innfeed/innlistener.c 2017-05-29 20:22:53 UTC (rev 10145)
+++ innfeed/innlistener.c 2017-06-03 14:16:58 UTC (rev 10146)
@@ -669,7 +669,8 @@
static void writeCheckPoint (int offsetAdjust)
{
- char offsetString[16], *writePointer ;
+ char offsetString[21]; /* size of long long may be 20 */
+ char *writePointer;
off_t offset ;
int writeBytes, writeReturn, mainFd ;
Modified: nnrpd/post.c
===================================================================
--- nnrpd/post.c 2017-05-29 20:22:53 UTC (rev 10145)
+++ nnrpd/post.c 2017-06-03 14:16:58 UTC (rev 10146)
@@ -340,8 +340,8 @@
static char pathidentitybuff[SMBUF];
static char complaintsbuff[SMBUF];
static char postingaccountbuff[SMBUF];
- static char postinghostbuff[SMBUF];
- static char sendbuff[SMBUF];
+ static char postinghostbuff[SMBUF*2]; /* Allocate enough room. */
+ static char sendbuff[SMBUF*2];
static char injectioninfobuff[SMBUF];
static char *newpath = NULL;
HEADER *hp;
Modified: storage/cnfs/cnfs.c
===================================================================
--- storage/cnfs/cnfs.c 2017-05-29 20:22:53 UTC (rev 10145)
+++ storage/cnfs/cnfs.c 2017-06-03 14:16:58 UTC (rev 10146)
@@ -87,7 +87,8 @@
uint32_t block;
uint32_t cycnum;
- snprintf(cycbuffname, sizeof(cycbuffname), "%s", token.token);
+ snprintf(cycbuffname, sizeof(cycbuffname), "%.*s",
+ (int) sizeof(cycbuffname)-1, token.token);
if ((cycbuff = CNFSgetcycbuffbyname(cycbuffname)) == NULL) {
blksz = CNFS_DFL_BLOCKSIZE;
More information about the inn-committers
mailing list