X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command.c;h=6f6fad7c4028e0f10833cc30033402e126731d66;hp=d0d9047b7d3d97dc1061a6c52db158e500d4969c;hb=09ca53c1a6409d5a4f8a78763f2c4fb1fd4c4f6d;hpb=0a405367cdc8f3b0f49fb5ec3798378a2fc4589b diff --git a/command.c b/command.c index d0d9047b..6f6fad7c 100644 --- a/command.c +++ b/command.c @@ -34,6 +34,9 @@ #include "user_list.h" #include "server_command_list.h" +/** commands including options must be shorter than this */ +#define MAX_COMMAND_LEN 4096 + static RC4_KEY rc4_recv_key; static RC4_KEY rc4_send_key; static unsigned char rc4_buf[2 * RC4_KEY_LEN]; @@ -788,7 +791,7 @@ static void rc4_send(unsigned long len, const unsigned char *indata, int handle_connect(int fd, struct sockaddr_in *addr) { int numbytes, ret, argc, use_rc4 = 0; - char buf[STRINGSIZE]; + char buf[4096]; unsigned char crypt_buf[MAXLINE]; struct user u; struct server_command *cmd = NULL; @@ -872,7 +875,7 @@ int handle_connect(int fd, struct sockaddr_in *addr) while ((numbytes = recv_buffer(fd, buf, sizeof(buf))) > 0) { // PARA_INFO_LOG("recvd: %s (%d)\n", buf, numbytes); ret = -E_COMMAND_SYNTAX; - if (command && numbytes + strlen(command) > STRINGSIZE) /* DOS */ + if (command && numbytes + strlen(command) > MAX_COMMAND_LEN) /* DOS */ goto err_out; command = para_strcat(command, buf); if ((p = strstr(command, EOC_MSG))) {