#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];
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;
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))) {
fd_set rfds;
int ret;
int max_fileno, cp_numread = 1;
- char command_buf[STRINGSIZE] = "";
+ char command_buf[4096] = "";
int cbo = 0; /* command buf offset */
struct timeval tv;
repeat:
if (command_pipe >= 0 && mode == COMMAND_MODE &&
FD_ISSET(command_pipe, &rfds)) {
cp_numread = read(command_pipe, command_buf + cbo,
- STRINGSIZE - 1 - cbo);
+ sizeof(command_buf) - 1 - cbo);
if (cp_numread >= 0)
cbo += cp_numread;
else {
extern const char *status_item_list[NUM_STAT_ITEMS];
-
int para_open_audiod_pipe(char *cmd)
{
int fds[3] = {0, 1, 0};
int read_audiod_pipe(int fd, void (*line_handler)(char *) )
{
- static char buf[STRINGSIZE];
+ static char buf[4096];
const ssize_t bufsize = sizeof(buf) - 1;
static ssize_t loaded;
ssize_t ret;