From af20494b47503f178d7d8ddb57f2cfcaa15ccdb7 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Mon, 17 Oct 2022 22:16:37 +0100 Subject: [PATCH] Do not allow the first field (version) to be empty --- src/sso/sso.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sso/sso.c b/src/sso/sso.c index 985237f..e4b2263 100644 --- a/src/sso/sso.c +++ b/src/sso/sso.c @@ -210,16 +210,15 @@ static int sso_ticket_deserialize(sso_ticket_t *t, char *s) { sso_ticket_t tmp = sso_ticket_new(NULL, NULL, NULL, NULL, NULL, NULL, 0); int i; - /* - * Split s into fields, which may be empty. - */ + // Split s into fields, which may be empty. for (i = 0, ss = s; ss; i++) { token = ss; ss = strchr(ss, FIELD_SEP_CH); if (ss != NULL) { *ss++ = '\0'; } - if (*token == 0) { + // Skip empty fields, except for the first one. + if (i > 0 && *token == 0) { continue; } switch (i) { -- GitLab