1
0
mirror of https://github.com/payden/libwsclient synced 2024-10-27 17:54:01 +00:00

Fix snprintf size greater than buffer size.

This commit is contained in:
Payden Sutherland 2012-10-30 00:20:06 -04:00
parent 0002a5bec3
commit e8a7956336

View File

@ -410,9 +410,9 @@ void *libwsclient_handshake_thread(void *ptr) {
memset(request_headers, 0, 1024);
if(strcmp(port, "80") != 0) {
snprintf(request_host, 256, "%s:%s", host, port);
snprintf(request_host, 255, "%s:%s", host, port);
} else {
snprintf(request_host, 256, "%s", host);
snprintf(request_host, 255, "%s", host);
}
snprintf(request_headers, 1024, "GET %s HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: %s\r\nSec-WebSocket-Key: %s\r\nSec-WebSocket-Version: 13\r\n\r\n", path, request_host, websocket_key);
n = send(client->sockfd, request_headers, strlen(request_headers), 0);