From 5e071f200c4cc86443af07a876ee0e1c2901fda1 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Fri, 31 Oct 2014 09:31:02 -0400 Subject: bus: do not segfault on zeros in errno mapping table Depending on the link order, holes might appear in the body of the sd_bus_errnomap section. Ignore them. Adds a simple test to print the table to help with debugging such issues in the future. --- src/libsystemd/sd-bus/bus-error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libsystemd/sd-bus/bus-error.c') diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c index 2e64b925f3..ad1a66da72 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c @@ -80,7 +80,7 @@ static int bus_error_mapping_lookup(const char *name, size_t len) { const sd_bus_name_error_mapping *m; for (m = __start_sd_bus_errnomap; m < __stop_sd_bus_errnomap; m++) - if (strneq(m->name, name, len)) + if (m->name && strneq(m->name, name, len)) return m->code; return EIO; -- cgit v1.2.3-54-g00ecf