From: Roy Marples Date: Sat, 20 Jun 2026 22:00:57 +0000 (+0100) Subject: udev: Ensure we have a subsystem, action and ifname X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=69f107577daf6bddbcf8e1a3384935cf567e623f;p=thirdparty%2Fdhcpcd.git udev: Ensure we have a subsystem, action and ifname As udev could return NULL for them. Reported by NVIDIA Project Vanessa --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84a4015d..c8ce6aa2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,9 @@ jobs: os: [ ubuntu-latest, ubuntu-22.04 ] runs-on: ${{ matrix.os }} + - name: Install libudev-dev + run: sudo apt install -y pkg-config libudev-dev + steps: - uses: actions/checkout@v6 diff --git a/src/dev/udev.c b/src/dev/udev.c index 5a6735b5..0e43b169 100644 --- a/src/dev/udev.c +++ b/src/dev/udev.c @@ -90,9 +90,12 @@ udev_handle_device(void *ctx) action = udev_device_get_action(device); /* udev filter documentation says "usually" so double check */ - if (strcmp(subsystem, "net") == 0) { + if (subsystem != NULL && strcmp(subsystem, "net") == 0) { logdebugx("%s: libudev: %s", ifname, action); - if (strcmp(action, "add") == 0 || strcmp(action, "move") == 0) + if (action == NULL || ifname == NULL) + ; + else if (strcmp(action, "add") == 0 || + strcmp(action, "move") == 0) dhcpcd.handle_interface(ctx, 1, ifname); else if (strcmp(action, "remove") == 0) dhcpcd.handle_interface(ctx, -1, ifname);