INN commit: branches/2.6 (5 files)
INN Commit
rra at isc.org
Sat Nov 4 15:34:53 UTC 2017
Date: Saturday, November 4, 2017 @ 08:34:52
Author: iulius
Revision: 10184
Enforce new GCC 6 warning options; fix possible NULL-pointer dereferences
Add the following warning options:
-Wnull-dereference
-Wshift-overflow=2
-Wduplicated-cond
Do not explicitly mention -Wendif-labels because it is enabled by default.
Also use -O3 instead of -O2.
Fix in timehash and buffindexed code possible NULL-pointer dereferences.
Modified:
branches/2.6/Makefile.global.in
branches/2.6/doc/pod/news.pod
branches/2.6/innfeed/imap_connection.c
branches/2.6/storage/buffindexed/buffindexed.c
branches/2.6/storage/timehash/timehash.c
-----------------------------------+
Makefile.global.in | 12 +++++++-----
doc/pod/news.pod | 4 ++++
innfeed/imap_connection.c | 2 +-
storage/buffindexed/buffindexed.c | 10 ++++++++++
storage/timehash/timehash.c | 13 ++++++++++---
5 files changed, 32 insertions(+), 9 deletions(-)
Modified: Makefile.global.in
===================================================================
--- Makefile.global.in 2017-11-04 15:23:34 UTC (rev 10183)
+++ Makefile.global.in 2017-11-04 15:34:52 UTC (rev 10184)
@@ -83,9 +83,9 @@
## warn on system headers. The warnings below are in the same order as
## they're listed in the gcc manual.
##
-## Last checked against gcc 4.7.4 (2014-06-12).
+## Last checked against gcc 6.3.0 (2017-11-04).
## Add -g because when building with warnings, one generally also wants the
-## debugging information, and add -O2 because gcc won't find some warnings
+## debugging information, and add -O3 because gcc won't find some warnings
## without optimization turned on. Add -DDEBUG=1 so that we'll also
## compile all debugging code and check it as well.
## It would be worthwhile trying to enforce the following checks:
@@ -96,9 +96,11 @@
## "-Wconversion -Wno-sign-conversion",
## -Wunreachable-code, -Wstack-protector, -Wdeclaration-after-statement
-WARNINGS = -g -O2 -DDEBUG=1 -Werror -Wall -Wextra \
- -Winit-self -Wmissing-include-dirs \
- -Wsync-nand -Wendif-labels -Wtrampolines -Wpointer-arith \
+WARNINGS = -g -O3 -DDEBUG=1 -Werror -Wall -Wextra \
+ -Wnull-dereference -Winit-self -Wmissing-include-dirs \
+ -Wshift-overflow=2 \
+ -Wsync-nand -Wmissing-format-attribute -Wduplicated-cond \
+ -Wtrampolines -Wpointer-arith \
-Wbad-function-cast -Wcast-align -Wwrite-strings \
-Wjump-misses-init -Wstrict-prototypes \
-Wold-style-definition \
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2017-11-04 15:23:34 UTC (rev 10183)
+++ doc/pod/news.pod 2017-11-04 15:34:52 UTC (rev 10184)
@@ -42,6 +42,10 @@
daily Usenet reports were appearing as a mere letter; all of them are
now properly converted to meaningful words.
+=item *
+
+Other minor bug fixes and documentation improvements.
+
=back
=head1 Changes in 2.6.1
Modified: innfeed/imap_connection.c
===================================================================
--- innfeed/imap_connection.c 2017-11-04 15:23:34 UTC (rev 10183)
+++ innfeed/imap_connection.c 2017-11-04 15:34:52 UTC (rev 10184)
@@ -1249,7 +1249,7 @@
*result = authid;
if (len)
*len = authid ? strlen(authid) : 0;
- break;
+ break;
case SASL_CB_LANGUAGE:
*result = NULL;
if (len)
Modified: storage/buffindexed/buffindexed.c
===================================================================
--- storage/buffindexed/buffindexed.c 2017-11-04 15:23:34 UTC (rev 10183)
+++ storage/buffindexed/buffindexed.c 2017-11-04 15:34:52 UTC (rev 10184)
@@ -1724,6 +1724,12 @@
for (gdb = groupdatablock[i] ; gdb != NULL ; gdb = gdb->next) {
ov = gdb->datablk;
ovbuff = getovbuff(ov);
+ if (ovbuff == NULL) {
+ warn("buffindexed: ovgroupmmap could not get ovbuff block for new, %d, %d", ov.index, ov.blocknum);
+ free(gdb);
+ ovgroupunmap();
+ return false;
+ }
offset = ovbuff->base + OV_OFFSET(ov.blocknum);
pagefudge = offset % pagesize;
mmapoffset = offset - pagefudge;
@@ -1860,6 +1866,10 @@
search->gdb.datablk.blocknum = srchov.blocknum;
search->gdb.datablk.index = srchov.index;
ovbuff = getovbuff(srchov);
+ if (ovbuff == NULL) {
+ warn("buffindexed: ovsearch could not get ovbuff block for new, %d, %d, %ld", srchov.index, srchov.blocknum, *artnum);
+ return false;
+ }
offset = ovbuff->base + OV_OFFSET(srchov.blocknum);
pagefudge = offset % pagesize;
mmapoffset = offset - pagefudge;
Modified: storage/timehash/timehash.c
===================================================================
--- storage/timehash/timehash.c 2017-11-04 15:23:34 UTC (rev 10183)
+++ storage/timehash/timehash.c 2017-11-04 15:34:52 UTC (rev 10184)
@@ -121,8 +121,9 @@
n = sscanf(path, "time-%02x/%02x/%02x/%04x-%04x",
&tclass, &t1, &t2, &seqnum, &t3);
- if (n != 5)
- return (TOKEN *)NULL;
+ if (n != 5) {
+ return (TOKEN *)NULL;
+ }
now = ((t1 << 16) & 0xff0000) | ((t2 << 8) & 0xff00) | ((t3 << 16) & 0xff000000) | (t3 & 0xff);
class = tclass;
token = MakeToken(now, seqnum, class, (TOKEN *)NULL);
@@ -435,6 +436,7 @@
ARTHANDLE *art;
int seqnum;
size_t length;
+ TOKEN *nexttoken;
length = strlen(innconf->patharticles) + 32;
path = xmalloc(length);
@@ -529,7 +531,12 @@
newpriv->secde = priv.secde;
newpriv->terde = priv.terde;
snprintf(path, length, "%s/%s/%s/%s", priv.topde->d_name, priv.secde->d_name, priv.terde->d_name, de->d_name);
- art->token = PathToToken(path);
+ nexttoken = PathToToken(path);
+ if (nexttoken == (TOKEN *)NULL) {
+ free(path);
+ return NULL;
+ }
+ art->token = nexttoken;
BreakToken(*art->token, &(art->arrived), &seqnum);
free(path);
return art;
More information about the inn-committers
mailing list