- 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++;