bus: also check for NULL when appending trivial types
authorLennart Poettering <lennart@poettering.net>
Thu, 7 Nov 2013 16:11:25 +0000 (17:11 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 7 Nov 2013 16:11:25 +0000 (17:11 +0100)
src/libsystemd-bus/bus-message.c

index 4b53a6c..3f9baca 100644 (file)
@@ -1379,6 +1379,7 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void
                 break;
 
         case SD_BUS_TYPE_BOOLEAN:
+
                 if (!p) {
                         r = -EINVAL;
                         goto fail;
@@ -1434,6 +1435,11 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void
         }
 
         default:
+                if (!p) {
+                        r = -EINVAL;
+                        goto fail;
+                }
+
                 align = bus_type_get_alignment(type);
                 sz = bus_type_get_size(type);
                 break;