diff options
author | spz <spz@pkgsrc.org> | 2017-12-11 07:54:42 +0000 |
---|---|---|
committer | spz <spz@pkgsrc.org> | 2017-12-11 07:54:42 +0000 |
commit | f8b261f486ccba1336813536e8d0289123c701ce (patch) | |
tree | e954e8a6540ac3108f8e87b624a59ffa9a5dedde /chat/i2cbd/patches | |
parent | fab106dea132d9c5e092e0bb355e7ac01371e393 (diff) | |
download | pkgsrc-f8b261f486ccba1336813536e8d0289123c701ce.tar.gz |
RELRO and friends
fix the issues found by -Wall
Diffstat (limited to 'chat/i2cbd/patches')
-rw-r--r-- | chat/i2cbd/patches/patch-aa | 4 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-ab | 17 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-src_Makefile | 15 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-src_access.c | 24 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-src_groups.c | 17 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-src_ipcf.c | 15 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-src_main.c | 25 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-src_s__group.c | 48 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-src_s__user.c | 24 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-src_send.c | 15 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-src_serverserve.c | 37 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-src_signals.c | 47 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-util_Makefile | 15 |
13 files changed, 294 insertions, 9 deletions
diff --git a/chat/i2cbd/patches/patch-aa b/chat/i2cbd/patches/patch-aa index 1e93c9d5bfc..55ecc190bb9 100644 --- a/chat/i2cbd/patches/patch-aa +++ b/chat/i2cbd/patches/patch-aa @@ -1,4 +1,6 @@ -$NetBSD: patch-aa,v 1.2 2003/07/29 16:25:56 jmmv Exp $ +$NetBSD: patch-aa,v 1.3 2017/12/11 07:54:42 spz Exp $ + +pkgsrcify --- config.h.orig Tue Oct 30 20:37:28 2001 +++ config.h diff --git a/chat/i2cbd/patches/patch-ab b/chat/i2cbd/patches/patch-ab index 8f44668c580..563120297a9 100644 --- a/chat/i2cbd/patches/patch-ab +++ b/chat/i2cbd/patches/patch-ab @@ -1,6 +1,9 @@ -$NetBSD: patch-ab,v 1.4 2003/10/24 21:12:18 jwise Exp $ ---- config.mk.orig Tue Oct 30 20:50:40 2001 -+++ config.mk Sat Aug 2 22:28:11 2003 +$NetBSD: patch-ab,v 1.5 2017/12/11 07:54:42 spz Exp $ + +pkgsrcify + +--- config.mk.orig 2003-10-24 20:47:04.000000000 +0000 ++++ config.mk @@ -3,7 +3,6 @@ # For copying and distribution information, see the file COPYING. # @@ -9,12 +12,14 @@ $NetBSD: patch-ab,v 1.4 2003/10/24 21:12:18 jwise Exp $ BINDIR = ${PREFIX}/sbin MANDIR = ${PREFIX}/man MAN8DIR = ${PREFIX}/man/man8 -@@ -19,7 +18,7 @@ +@@ -19,8 +18,8 @@ EXTRAWARNS = -Wshadow -Wpointer-arith -W # affect portability to some platforms. The others here are irrelevant. BADWARNS = -Wwrite-strings -Wconversion -Waggregate-return -Wredundant-decls DEBUG = -DDEBUG -DVERBOSE -g -CFLAGS = ${WARNS} ${EXTRAWARNS} ${DEBUG} -+CFLAGS = ${WARNS} ${EXTRAWARNS} ${DEBUG} -DPREFIX=\"${PREFIX}\" -DPKG_SYSCONFDIR=\"${PKG_SYSCONFDIR}\" - LDFLAGS = +-LDFLAGS = ++CFLAGS += ${WARNS} ${EXTRAWARNS} ${DEBUG} -DPREFIX=\"${PREFIX}\" -DPKG_SYSCONFDIR=\"${PKG_SYSCONFDIR}\" ++#LDFLAGS = LIBS = -lutil + LINT = lint diff --git a/chat/i2cbd/patches/patch-src_Makefile b/chat/i2cbd/patches/patch-src_Makefile new file mode 100644 index 00000000000..45e16d1defa --- /dev/null +++ b/chat/i2cbd/patches/patch-src_Makefile @@ -0,0 +1,15 @@ +$NetBSD: patch-src_Makefile,v 1.1 2017/12/11 07:54:42 spz Exp $ + +RELRO package + +--- src/Makefile.orig 2006-05-11 03:44:52.000000000 +0000 ++++ src/Makefile +@@ -91,7 +91,7 @@ all: icbd + icbd: $(OBJ) + + icbd: $(OBJ) +- $(CC) $(LDFLAGS) -o icbd $(OBJ) $(LIBS) $(OTHERLIBS) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o icbd $(OBJ) $(LIBS) $(OTHERLIBS) + + install: all + ${INSTALL} -c -s -m 0755 icbd $(BINDIR)/icbd diff --git a/chat/i2cbd/patches/patch-src_access.c b/chat/i2cbd/patches/patch-src_access.c index c355ea279e1..ba0b26d1244 100644 --- a/chat/i2cbd/patches/patch-src_access.c +++ b/chat/i2cbd/patches/patch-src_access.c @@ -1,8 +1,10 @@ -$NetBSD: patch-src_access.c,v 1.2 2015/11/22 17:17:33 dholland Exp $ +$NetBSD: patch-src_access.c,v 1.3 2017/12/11 07:54:42 spz Exp $ Fix bounding errors detected by OpenBSD's compiler. ---- src/access.c~ 2006-05-11 03:44:52.000000000 +0000 +don't cut off realnames or passwords + +--- src/access.c.orig 2006-05-11 03:44:52.000000000 +0000 +++ src/access.c @@ -341,7 +341,7 @@ nickreadmsg(int forWhom) strncpy(from, data.data, data.size); @@ -13,6 +15,24 @@ Fix bounding errors detected by OpenBSD's compiler. userdb->del(userdb, &key, 0); snprintf(kbuf, KEY_SIZE, "%s.message%d", u_tab[forWhom].nickname, i); +@@ -461,7 +461,7 @@ nickchpass(int forWhom, const char *oldp + strncpy(line, data.data, data.size); + line[data.size] = '\0'; + +- if (strncmp(line, oldpw, MAX_PASSWDLEN)) { ++ if (strncmp(line, oldpw, MAX_PASSWDLEN+1)) { + snprintf(line, LINE_SIZE, "Authorization failure"); + senderror(forWhom, line); + } else { +@@ -522,7 +522,7 @@ nickwrite (int forWhom, const char *pass + snprintf(line, LINE_SIZE, "Nick registered"); + sends_cmdout(forWhom, line); + +- strlcpy(u_tab[forWhom].realname, "registered", MAX_REALLEN); ++ strlcpy(u_tab[forWhom].realname, "registered", MAX_REALLEN+1); + strlcpy(u_tab[forWhom].password, password, MAX_PASSWDLEN+1); + nickwritetime(forWhom, 0); + @@ -581,7 +581,7 @@ nickwrite (int forWhom, const char *pass snprintf(line, LINE_SIZE, "Nick registered"); sends_cmdout(forWhom, line); diff --git a/chat/i2cbd/patches/patch-src_groups.c b/chat/i2cbd/patches/patch-src_groups.c new file mode 100644 index 00000000000..4df07a3f355 --- /dev/null +++ b/chat/i2cbd/patches/patch-src_groups.c @@ -0,0 +1,17 @@ +$NetBSD: patch-src_groups.c,v 1.1 2017/12/11 07:54:42 spz Exp $ + +fix copy length + +--- src/groups.c.orig 2006-05-11 03:44:52.000000000 +0000 ++++ src/groups.c +@@ -168,8 +168,8 @@ check_mods(int u_index) + void + fill_group_entry(int n, char *name, char *topic, int visibility, int control, int mod, int volume) + { +- strlcpy(g_tab[n].name, name, MAX_GROUPLEN); +- strlcpy(g_tab[n].topic, topic, MAX_TOPICLEN); ++ strlcpy(g_tab[n].name, name, MAX_GROUPLEN+1); ++ strlcpy(g_tab[n].topic, topic, MAX_TOPICLEN+1); + + g_tab[n].visibility = visibility; + g_tab[n].control = control; diff --git a/chat/i2cbd/patches/patch-src_ipcf.c b/chat/i2cbd/patches/patch-src_ipcf.c new file mode 100644 index 00000000000..f226b475a17 --- /dev/null +++ b/chat/i2cbd/patches/patch-src_ipcf.c @@ -0,0 +1,15 @@ +$NetBSD: patch-src_ipcf.c,v 1.1 2017/12/11 07:54:42 spz Exp $ + +fix copy length + +--- src/ipcf.c.orig 2006-05-11 03:44:52.000000000 +0000 ++++ src/ipcf.c +@@ -217,7 +217,7 @@ s_lost_user(int n) + snprintf(line, LINE_SIZE, "Your group moderator signed off. (%d second timeout)", (int) MOD_TIMEOUT); + s_status_group(2,0,was_mod, "Mod", line); + g_tab[was_mod].mod = -1; +- strlcpy(g_tab[was_mod].missingmod, t_name, MAX_NICKLEN); ++ strlcpy(g_tab[was_mod].missingmod, t_name, MAX_NICKLEN+1); + TheTime = time(NULL); + g_tab[was_mod].modtimeout = TheTime + MOD_TIMEOUT; + } diff --git a/chat/i2cbd/patches/patch-src_main.c b/chat/i2cbd/patches/patch-src_main.c new file mode 100644 index 00000000000..1f64c701c47 --- /dev/null +++ b/chat/i2cbd/patches/patch-src_main.c @@ -0,0 +1,25 @@ +$NetBSD: patch-src_main.c,v 1.1 2017/12/11 07:54:42 spz Exp $ + +fix daemon call +fix copy length + +--- src/main.c.orig 2006-05-11 03:44:52.000000000 +0000 ++++ src/main.c +@@ -113,7 +113,7 @@ main (int argc, char **argv) + } + + if (noforkflag == 0) +- daemon(0,0); ++ daemon(1,0); + + pidfile("icbd"); + +@@ -132,7 +132,7 @@ main (int argc, char **argv) + u_tab[NICKSERV].login = 1; + u_tab[NICKSERV].t_on = TheTime; + u_tab[NICKSERV].t_recv = TheTime; +- strlcpy(u_tab[NICKSERV].realname, "registered", MAX_NICKLEN); ++ strlcpy(u_tab[NICKSERV].realname, "registered", MAX_NICKLEN+1); + fill_group_entry(0, "ICB", "...here to serve you!", SUPERSECRET, RESTRICTED, NICKSERV, QUIET); + nickwritetime(NICKSERV, 0); + diff --git a/chat/i2cbd/patches/patch-src_s__group.c b/chat/i2cbd/patches/patch-src_s__group.c new file mode 100644 index 00000000000..438e50a5cd0 --- /dev/null +++ b/chat/i2cbd/patches/patch-src_s__group.c @@ -0,0 +1,48 @@ +$NetBSD: patch-src_s__group.c,v 1.1 2017/12/11 07:54:42 spz Exp $ + +fix copy lengths + +--- src/s_group.c.orig 2006-05-11 03:44:53.000000000 +0000 ++++ src/s_group.c +@@ -260,7 +260,7 @@ s_change(int n, int argc) + } + /* could create it, so fill in the info */ + g_tab[ngi].visibility = visibility; +- strlcpy(g_tab[ngi].name, n_g_n, MAX_GROUPLEN); ++ strlcpy(g_tab[ngi].name, n_g_n, MAX_GROUPLEN+1); + if (strcasecmp("1", n_g_n) != 0) { + g_tab[ngi].control = MODERATED; + g_tab[ngi].mod = n; +@@ -326,7 +326,7 @@ s_change(int n, int argc) + /* is the new group different than the old group? */ + if (ngi != ogi) { + /* the group exists and we are allowed in. */ +- strlcpy(u_tab[n].group, g_tab[ngi].name, MAX_GROUPLEN); ++ strlcpy(u_tab[n].group, g_tab[ngi].name, MAX_GROUPLEN+1); + + /* tell the new group about the arrival */ + snprintf(line, LINE_SIZE, "%s (%s@%s) entered group", u_tab[n].nickname, +@@ -1056,7 +1056,7 @@ s_topic(int n, int argc) + return; + } + +- strlcpy(g_tab[t_group].topic,fields[1],MAX_TOPICLEN); ++ strlcpy(g_tab[t_group].topic,fields[1],MAX_TOPICLEN+1); + if (g_tab[t_group].volume != QUIET) { + snprintf(line, LINE_SIZE, "%s changed the topic to \"%s\"", + u_tab[n].nickname, +@@ -1210,12 +1210,12 @@ set_name(int n, int group, char *name) + /* and change their group name entries */ + for (i=0; i< MAX_REAL_USERS; i++) { + if (strcasecmp(u_tab[i].group, cp) == 0) { +- strlcpy(u_tab[i].group, n_g_n, MAX_GROUPLEN); ++ strlcpy(u_tab[i].group, n_g_n, MAX_GROUPLEN+1); + } + } + + /* finally change the name of the group itself */ +- strlcpy(g_tab[group].name, n_g_n, MAX_GROUPLEN); ++ strlcpy(g_tab[group].name, n_g_n, MAX_GROUPLEN+1); + return 0; + } + diff --git a/chat/i2cbd/patches/patch-src_s__user.c b/chat/i2cbd/patches/patch-src_s__user.c new file mode 100644 index 00000000000..f3b34bc37ee --- /dev/null +++ b/chat/i2cbd/patches/patch-src_s__user.c @@ -0,0 +1,24 @@ +$NetBSD: patch-src_s__user.c,v 1.1 2017/12/11 07:54:42 spz Exp $ + +fix copy length + +--- src/s_user.c.orig 2006-05-11 03:44:53.000000000 +0000 ++++ src/s_user.c +@@ -277,7 +277,7 @@ s_name(int n, int argc) + snprintf(line, LINE_SIZE, "%s changed nickname to %s", u_tab[n].nickname, new_name); + s_status_group(1,0,n,"Name",line); + nickwritetime(n, 1); +- strlcpy(u_tab[n].nickname, new_name, MAX_NICKLEN); ++ strlcpy(u_tab[n].nickname, new_name, MAX_NICKLEN+1); + + /* side-effects: + inform folx in same group of change +@@ -290,7 +290,7 @@ s_name(int n, int argc) + ret = nicklookup(-n, u_tab[n].nickname); + if (ret == 0) { + /* we know this person */ +- strlcpy(u_tab[n].realname, "registered", MAX_REALLEN); ++ strlcpy(u_tab[n].realname, "registered", MAX_REALLEN+1); + sends_cmdout(n, "Nick registered"); + nickwritetime(n, 0); + for (i = 1; i < MAX_GROUPS; i++) diff --git a/chat/i2cbd/patches/patch-src_send.c b/chat/i2cbd/patches/patch-src_send.c new file mode 100644 index 00000000000..9f100d8dce3 --- /dev/null +++ b/chat/i2cbd/patches/patch-src_send.c @@ -0,0 +1,15 @@ +$NetBSD: patch-src_send.c,v 1.1 2017/12/11 07:54:42 spz Exp $ + +fix copy length + +--- src/send.c.orig 2006-05-11 03:44:53.000000000 +0000 ++++ src/send.c +@@ -163,7 +163,7 @@ s_new_user(int n) + return; + } + snprintf(line, LINE_SIZE, "[CONNECT] %d: %s", n, cp); +- strlcpy(u_tab[n].nodeid, cp, MAX_NODELEN); ++ strlcpy(u_tab[n].nodeid, cp, MAX_NODELEN+1); + MDB(line); + } + diff --git a/chat/i2cbd/patches/patch-src_serverserve.c b/chat/i2cbd/patches/patch-src_serverserve.c new file mode 100644 index 00000000000..f6c85c5f1de --- /dev/null +++ b/chat/i2cbd/patches/patch-src_serverserve.c @@ -0,0 +1,37 @@ +$NetBSD: patch-src_serverserve.c,v 1.1 2017/12/11 07:54:42 spz Exp $ + +when checking FD_ISSET also check for <0 +start fd checks at 0 + +--- src/serverserve.c.orig 2006-05-11 03:50:28.000000000 +0000 ++++ src/serverserve.c 2008-03-21 16:22:20.000000000 +0000 +@@ -80,7 +80,7 @@ + for (i = 0; i < MAX_USERS+1; i++) + { + /* if it's currently being held */ +- if (FD_ISSET(i, &held_fdset) > 0) ++ if (FD_ISSET(i, &held_fdset)) + { + /* add it to fdset and remove it from held */ + FD_SET (i, &fdset); +@@ -106,16 +106,16 @@ + { + int n, x, fcarg; + +- for (x = 1; x <= highestfd; x++) +- if (FD_ISSET(x, &efdr) > 0) { ++ for (x = 0; x <= highestfd; x++) ++ if (FD_ISSET(x, &efdr)) { + disconnectuser(x); + } + + /* examine set of file descriptors */ +- for (x = 1; x <= highestfd; x++) { ++ for (x = 0; x <= highestfd; x++) { + int closed = 0; + +- if (FD_ISSET(x, &fdr) > 0) { ++ if (FD_ISSET(x, &fdr)) { + if (FD_ISSET(x,&serversocks)) { + /* new connect on advertised socket */ + if ((n = newconnect(x)) > 0) diff --git a/chat/i2cbd/patches/patch-src_signals.c b/chat/i2cbd/patches/patch-src_signals.c new file mode 100644 index 00000000000..75933c48227 --- /dev/null +++ b/chat/i2cbd/patches/patch-src_signals.c @@ -0,0 +1,47 @@ +$NetBSD: patch-src_signals.c,v 1.1 2017/12/11 07:54:42 spz Exp $ + +remember bricks +fix array overrun + +--- src/signals.c.orig 2006-05-11 03:44:53.000000000 +0000 ++++ src/signals.c +@@ -54,7 +54,7 @@ icbdump (int sig) + + fprintf (dump, "%d\n", highestfd); + +- for (i = 0; i <= MAX_REAL_USERS; i++) ++ for (i = 0; i < MAX_REAL_USERS; i++) + fprintf (dump, "%d\n", S_kill[i]); + + for (i = 0; i < MAX_USERS; i++) +@@ -168,6 +168,9 @@ icbdump (int sig) + fprintf(dump, "%sX\n", nlget(g_tab[i].nr_talk)); + } + ++ for (i = 0; i < MAX_REAL_USERS; i++) ++ fprintf (dump, "%d\n", S_bricks[i]); ++ + fclose(dump); + } + +@@ -198,7 +201,7 @@ icbload (int sig) + } + + fscanf (dump, "%d\n", &highestfd); +- for (i = 0; i <= MAX_REAL_USERS; i++) { ++ for (i = 0; i < MAX_REAL_USERS; i++) { + fscanf (dump, "%ld\n", &k); + S_kill[i] = (int)k; + } +@@ -368,5 +371,11 @@ icbload (int sig) + } + } + ++ for (i = 0; i < MAX_REAL_USERS; i++) { ++ fscanf (dump, "%ld\n", &k); ++ S_bricks[i] = (int)k; ++ } ++ ++ + fclose(dump); + } diff --git a/chat/i2cbd/patches/patch-util_Makefile b/chat/i2cbd/patches/patch-util_Makefile new file mode 100644 index 00000000000..151807ef5c7 --- /dev/null +++ b/chat/i2cbd/patches/patch-util_Makefile @@ -0,0 +1,15 @@ +$NetBSD: patch-util_Makefile,v 1.1 2017/12/11 07:54:42 spz Exp $ + +RELRO package + +--- util/Makefile.orig 2001-10-30 19:14:59.000000000 +0000 ++++ util/Makefile +@@ -10,7 +10,7 @@ SRCS= icbdb.c + all: icbdb + + icbdb: icbdb.c ../src/userdb.c +- $(CC) $(CFLAGS) -o icbdb icbdb.c ../src/userdb.c $(LIBS) $(OTHERLIBS) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o icbdb icbdb.c ../src/userdb.c $(LIBS) $(OTHERLIBS) + + install: all + ${INSTALL} -c -s -m 0755 icbdb $(BINDIR)/icbdb |