git.ucc.asn.au
/
matches
/
MCTX3420.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8c5bba9
)
modified version to get control key
author
Jeremy Tan
<
[email protected]
>
Mon, 21 Oct 2013 04:22:50 +0000
(12:22 +0800)
committer
Jeremy Tan
<
[email protected]
>
Mon, 21 Oct 2013 04:22:50 +0000
(12:22 +0800)
server/fastcgi.c
patch
|
blob
|
history
diff --git
a/server/fastcgi.c
b/server/fastcgi.c
index
f68bc4f
..
e3d9873
100644
(file)
--- a/
server/fastcgi.c
+++ b/
server/fastcgi.c
@@
-197,18
+197,17
@@
void FCGI_GetControlCookie(char buffer[CONTROL_KEY_BUFSIZ])
const char *cookies = getenv("COOKIE_STRING");
const char *start = strstr(cookies, "mctxkey=");
const char *cookies = getenv("COOKIE_STRING");
const char *start = strstr(cookies, "mctxkey=");
+ *buffer = 0; //Clear the buffer
if (start != NULL) {
if (start != NULL) {
- const char *end;
- size_t limit = CONTROL_KEY_BUFSIZ;
- start += 8; //Ah, magic numbers (the length of mctxkey= - 1)
- end = strchr(start, ';');
- if (end != NULL && (end-start) < CONTROL_KEY_BUFSIZ) {
- limit = (end-start) + 1;
+ int i;
+ start += 8; //length of mctxkey=
+ for (i = 0; i < CONTROL_KEY_BUFSIZ; i++) {
+ if (*start == 0 || *start == ';') {
+ break;
+ }
+ buffer[i] = *start++;
}
}
- snprintf(buffer, limit, "%s", start);
- Log(LOGDEBUG, "buf: %s", buffer);
- } else {
- *buffer = 0;
+ buffer[i] = 0;
}
}
}
}
UCC
git Repository :: git.ucc.asn.au