chiark / gitweb /
bus: when the first char a server receives isn't the NUL byte immediately fail
authorLennart Poettering <lennart@poettering.net>
Mon, 1 Apr 2013 01:24:43 +0000 (03:24 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 1 Apr 2013 01:29:29 +0000 (03:29 +0200)
src/libsystemd-bus/bus-socket.c

index 30e5942..82e683a 100644 (file)
@@ -313,13 +313,16 @@ static int bus_socket_auth_verify_server(sd_bus *b) {
 
         assert(b);
 
-        if (b->rbuffer_size < 3)
+        if (b->rbuffer_size < 1)
                 return 0;
 
         /* First char must be a NUL byte */
         if (*(char*) b->rbuffer != 0)
                 return -EIO;
 
+        if (b->rbuffer_size < 3)
+                return 0;
+
         /* Begin with the first line */
         if (b->auth_rbegin <= 0)
                 b->auth_rbegin = 1;