mirror of
https://github.com/sigmasternchen/CShore
synced 2025-03-15 16:18:56 +00:00
key check should use whole key length
This commit is contained in:
parent
9d0e533fa1
commit
70bf93a3ed
1 changed files with 10 additions and 9 deletions
|
@ -22,15 +22,16 @@ char* getCookie(ctx_t ctx, const char* key) {
|
||||||
|
|
||||||
char* value = NULL;
|
char* value = NULL;
|
||||||
|
|
||||||
while((str = strtok_r(str, ";", saveptr)) != NULL) {
|
while((str = strtok_r(str, "; ", saveptr)) != NULL) {
|
||||||
if (strncmp(str, key, keyLength) == 0) {
|
char* keyCandidate = str;
|
||||||
str = strtok_r(NULL, "=", saveptr)
|
str = strtok_r(NULL, "=", saveptr);
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
// illegal cookie definition; ignore
|
// illegal cookie definition; ignore
|
||||||
} else {
|
continue;
|
||||||
value = str;
|
}
|
||||||
break;
|
|
||||||
}
|
if (strcmp(keyCandidate, key) == 0) {
|
||||||
|
value = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = NULL;
|
str = NULL;
|
||||||
|
|
Loading…
Reference in a new issue