Package: ifupdown
Version: 0.8.10ubuntu1
Severity: important
Tags: patch

Dear Maintainer,

This was reported in Ubuntu as
https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1618726 but is present
in sid too.

Quoting from that report:

----
This is a trivially reproducible crash in ifup/ifdown, with a patch attached.

Steps to reproduce:
1) echo no-scripts foo bar >> /etc/network/interfaces
2) ifup baz

Expected results:
Unknown interface baz

Actual results:
Segmentation fault (core dumped)

It's irrelevant whether the second interface is on the same no-scripts line or 
separate one. This will crash just the same:
echo no-scripts foo >> /etc/network/interfaces
echo no-scripts bar >> /etc/network/interfaces
----

I'm attaching a patch based on the one the reporting user provided.

Cheers,
mwh


-- System Information:
Debian Release: stretch/sid
  APT prefers xenial-updates
  APT policy: (500, 'xenial-updates'), (500, 'xenial-security'), (500, 
'xenial'), (400, 'xenial-proposed'), (100, 'xenial-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-36-generic (SMP w/4 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages ifupdown depends on:
ii  adduser              3.113+nmu3ubuntu4
ii  init-system-helpers  1.29ubuntu2
ii  iproute2             4.3.0-1ubuntu3
ii  libc6                2.23-0ubuntu3
ii  lsb-base             9.20160110ubuntu0.2

Versions of packages ifupdown recommends:
ii  isc-dhcp-client [dhcp-client]  4.3.3-5ubuntu12.1

Versions of packages ifupdown suggests:
ii  ppp     2.4.7-1+2ubuntu1
pn  rdnssd  <none>

-- no debconf information
>From 74c10be956dc95d7368345445a21e1b8066ab537 Mon Sep 17 00:00:00 2001
From: Richard Laager <rlaa...@wiktel.com>
Date: Wed, 14 Sep 2016 11:51:29 +1200
Subject: [PATCH] Fix a crash when multiple interfaces are specified for
 no-scripts.

---
 config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.c b/config.c
index c14f625..bfade0f 100644
--- a/config.c
+++ b/config.c
@@ -395,7 +395,7 @@ static void add_to_list(char ***list, int *count, const char *item) {
 		perror("realloc");
 		exit(1);
 	}
-	*list[*count - 1] = strdup(item);
+	(*list)[*count - 1] = strdup(item);
 	if (!(*list)[*count - 1]) {
 		perror("strdup");
 		exit(1);
-- 
2.7.4

Reply via email to