include field separators in comparison

When comparing the first component of a multi-component
string that uses a field separator (e.g., '/' or ':'), be sure
to include the separator in the comparison to ensure that the
comparison does not succeed due to a prefix match.

Change-Id: Ieec3e73cb015a83bb652ec11cd7d83e57755c3d2
This commit is contained in:
Jeffrey Altman
2017-04-28 11:24:00 -04:00
parent 93518bfab4
commit 12afd9c4b7
2 changed files with 3 additions and 3 deletions

View File

@@ -176,7 +176,7 @@ main(int argc, char **argv)
ret = krb5_unparse_name(context, ticket->server, &server);
if (ret)
krb5_err(context, 1, ret, "krb5_unparse_name");
if (strncmp(server, "hprop/", 5) != 0)
if (strncmp(server, "hprop/", 6) != 0)
krb5_errx(context, 1, "ticket not for hprop (%s)", server);
free(server);