sd-bus: avoid magic number in SASL length calculation

Lets avoid magic numbers and use a constant `strlen()` instead.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
This commit is contained in:
David Rheinsberg 2019-03-14 13:26:50 +01:00
parent 94dfd646b3
commit 3cacdab925

View 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)