summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-01 03:24:43 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-01 03:29:29 +0200
commit2b4ac8896bdc6cc5159088d7d208559d53caacf3 (patch)
tree0cbfe719b03bae80647e12dd740db47cc10c217b /src/libsystemd-bus
parent8411d2a2b15ec8020cd563162cf1b372d8c0319a (diff)
bus: when the first char a server receives isn't the NUL byte immediately fail
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/bus-socket.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsystemd-bus/bus-socket.c b/src/libsystemd-bus/bus-socket.c
index 30e594243d..82e683a957 100644
--- a/src/libsystemd-bus/bus-socket.c
+++ b/src/libsystemd-bus/bus-socket.c
@@ -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;