]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - command.c
README: minor cleanups
[paraslash.git] / command.c
index d0d9047b7d3d97dc1061a6c52db158e500d4969c..6f6fad7c4028e0f10833cc30033402e126731d66 100644 (file)
--- 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))) {