char version[5] = "";
char proto[256] = "";
char proto_buf[384] = "";
- char uri[256] = "";
char input[256] = "";
unsigned char output[SHA1_HASH_SIZE] = "";
char b64[256] = "";
if (!e) {
goto err;
}
-
- strncpy(uri, p, e-p);
-
+
+ wsh->uri = malloc((e-p) + 1);
+ strncpy(wsh->uri, p, e-p);
+ *(wsh->uri + (e-p)) = '\0';
+
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Key", key, sizeof(key));
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Version", version, sizeof(version));
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Protocol", proto, sizeof(proto));
wsh->down = 1;
+ if (wsh->uri) {
+ free(wsh->uri);
+ wsh->uri = NULL;
+ }
+
if (reason && wsh->sock != ws_sock_invalid) {
uint16_t *u16;
uint8_t fr[4] = {WSOC_CLOSE | 0x80, 2, 0};
char version[5] = "";
char proto[256] = "";
char proto_buf[384] = "";
- char uri[256] = "";
char input[256] = "";
unsigned char output[SHA1_HASH_SIZE] = "";
char b64[256] = "";
if (!e) {
goto err;
}
-
- strncpy(uri, p, e-p);
-
+
+ wsh->uri = malloc((e-p) + 1);
+ strncpy(wsh->uri, p, e-p);
+ *(wsh->uri + (e-p)) = '\0';
+
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Key", key, sizeof(key));
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Version", version, sizeof(version));
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Protocol", proto, sizeof(proto));
wsh->down = 1;
+ if (wsh->uri) {
+ free(wsh->uri);
+ wsh->uri = NULL;
+ }
+
if (reason && wsh->sock != ws_sock_invalid) {
uint16_t *u16;
uint8_t fr[4] = {WSOC_CLOSE | 0x80, 2, 0};