Skip to content

Commit a4dc95d

Browse files
committed
Fix buffer overflow and use after free.
Upstream requests: pali/igmpproxy#98 pali/igmpproxy#99 ok tb@
1 parent 209aa47 commit a4dc95d

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

net/igmpproxy/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ COMMENT = multicast router utilizing IGMP forwarding
22

33
V = 0.4
44
DISTNAME = igmpproxy-${V}
5-
REVISION = 0
5+
REVISION = 1
66

77
CATEGORIES = net
88

net/igmpproxy/patches/patch-src_igmp_c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
Index: src/igmp.c
22
--- src/igmp.c.orig
33
+++ src/igmp.c
4+
@@ -84,7 +84,7 @@ void initIgmp(void) {
5+
* Finds the textual name of the supplied IGMP request.
6+
*/
7+
static const char *igmpPacketKind(unsigned int type, unsigned int code) {
8+
- static char unknown[20];
9+
+ static char unknown[32];
10+
11+
switch (type) {
12+
case IGMP_MEMBERSHIP_QUERY: return "Membership query ";
13+
@@ -94,7 +94,7 @@ static const char *igmpPacketKind(unsigned int type, u
14+
case IGMP_V2_LEAVE_GROUP: return "Leave message ";
15+
16+
default:
17+
- sprintf(unknown, "unk: 0x%02x/0x%02x ", type, code);
18+
+ snprintf(unknown, sizeof unknown, "unk: 0x%02x/0x%02x ", type, code);
19+
return unknown;
20+
}
21+
}
422
@@ -132,6 +132,7 @@ void acceptIgmp(int recvlen) {
523
}
624
else {

net/igmpproxy/patches/patch-src_rttable_c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,24 @@ Index: src/rttable.c
404404

405405
// We append the activity counter to the age, and continue...
406406
croute->ageValue = croute->ageActivity;
407-
@@ -718,39 +704,61 @@ int internAgeRoute(struct RouteTable* croute) {
407+
@@ -704,13 +690,15 @@ int internAgeRoute(struct RouteTable* croute) {
408+
409+
// No activity was registered within the timelimit, so remove the route.
410+
removeRoute(croute);
411+
+ croute = NULL;
412+
}
413+
// Tell that the route was updated...
414+
result = 1;
415+
}
416+
417+
// The aging vif bits must be reset for each round...
418+
- BIT_ZERO(croute->ageVifBits);
419+
+ if (croute != NULL)
420+
+ BIT_ZERO(croute->ageVifBits);
421+
422+
return result;
423+
}
424+
@@ -718,39 +706,61 @@ int internAgeRoute(struct RouteTable* croute) {
408425
/**
409426
* Updates the Kernel routing table. If activate is 1, the route
410427
* is (re-)activated. If activate is false, the route is removed.
@@ -480,7 +497,7 @@ Index: src/rttable.c
480497
}
481498

482499
// Do the actual Kernel route update...
483-
@@ -772,7 +780,7 @@ int internUpdateKernelRoute(struct RouteTable *route,
500+
@@ -772,7 +782,7 @@ int internUpdateKernelRoute(struct RouteTable *route,
484501
*/
485502
void logRouteTable(const char *header) {
486503
struct Config *conf = getCommonConfig();
@@ -489,7 +506,7 @@ Index: src/rttable.c
489506
unsigned rcount = 0;
490507

491508
my_log(LOG_DEBUG, 0, "");
492-
@@ -781,30 +789,22 @@ void logRouteTable(const char *header) {
509+
@@ -781,30 +791,22 @@ void logRouteTable(const char *header) {
493510
if(croute==NULL) {
494511
my_log(LOG_DEBUG, 0, "No routes in table...");
495512
} else {

0 commit comments

Comments
 (0)