]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-bus: avoid magic number in SASL length calculation
authorDavid Rheinsberg <david.rheinsberg@gmail.com>
Thu, 14 Mar 2019 12:26:50 +0000 (13:26 +0100)
committerDavid Rheinsberg <david.rheinsberg@gmail.com>
Thu, 14 Mar 2019 12:31:14 +0000 (13:31 +0100)
Lets avoid magic numbers and use a constant `strlen()` instead.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
src/libsystemd/sd-bus/bus-socket.c

index 89ac503ab84c83b2898f7826131e14d09c4883b3..8ee925014230b177071edcf12edfa37a602b86d8 100644 (file)
@@ -386,7 +386,9 @@ static int bus_socket_auth_verify_server(sd_bus *b) {
 
                 if (line_begins(line, l, "AUTH ANONYMOUS")) {
 
-                        r = verify_anonymous_token(b, line + 14, l - 14);
+                        r = verify_anonymous_token(b,
+                                                   line + strlen("AUTH ANONYMOUS"),
+                                                   l - strlen("AUTH ANONYMOUS"));
                         if (r < 0)
                                 return r;
                         if (r == 0)
@@ -398,7 +400,9 @@ static int bus_socket_auth_verify_server(sd_bus *b) {
 
                 } else if (line_begins(line, l, "AUTH EXTERNAL")) {
 
-                        r = verify_external_token(b, line + 13, l - 13);
+                        r = verify_external_token(b,
+                                                  line + strlen("AUTH EXTERNAL"),
+                                                  l - strlen("AUTH EXTERNAL"));
                         if (r < 0)
                                 return r;
                         if (r == 0)