Heap of segfaults fixed
This commit is contained in:
parent
b0daf2e365
commit
a8713fb367
@ -56,8 +56,6 @@ md5 "%ss_filename%" | write "%ss_filename%.md5" "%PIPE%"
|
|||||||
# Read md5 file
|
# Read md5 file
|
||||||
read "%ss_filename%.md5"
|
read "%ss_filename%.md5"
|
||||||
|
|
||||||
write("test.txt", "testing data");
|
|
||||||
|
|
||||||
# Delete function, SS can delete files and directories with one function
|
# Delete function, SS can delete files and directories with one function
|
||||||
# NOTE: it is extremely powerful and can wreck your system if used in the
|
# NOTE: it is extremely powerful and can wreck your system if used in the
|
||||||
# wrong way! Proceed with caution, delete "/" WILL send your files to the
|
# wrong way! Proceed with caution, delete "/" WILL send your files to the
|
||||||
|
12
src/deps.h
12
src/deps.h
@ -19,20 +19,20 @@
|
|||||||
// For checking if file exists
|
// For checking if file exists
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define MAX_VAR_NAME_LEN 128
|
#define MAX_VAR_NAME_LEN 512
|
||||||
#define MAX_VAR_NAME_BUFSIZE (MAX_VAR_NAME_LEN + 1)
|
#define MAX_VAR_NAME_BUFSIZE (MAX_VAR_NAME_LEN + 1)
|
||||||
#define MAX_STRING_LEN 4096
|
#define MAX_STRING_LEN 4096
|
||||||
#define MAX_STRING_BUFSIZE (MAX_STRING_LEN + 1)
|
#define MAX_STRING_BUFSIZE (MAX_STRING_LEN + 1)
|
||||||
#define MAX_VAR_DATA_LEN 4096
|
#define MAX_VAR_DATA_LEN 65536
|
||||||
#define MAXVARS 2048
|
#define MAXVARS 1488
|
||||||
#define MAX_CONCAT_BUF 2048
|
#define MAX_CONCAT_BUF 131072
|
||||||
#define MAX_READFILE_LEN 2097152
|
#define MAX_READFILE_LEN 2097152
|
||||||
// for networking functions
|
// for networking functions
|
||||||
#define MAX_ADDRESS_LEN 256
|
#define MAX_ADDRESS_LEN 256
|
||||||
#define MAX_ADDRESS_BUF (MAX_ADDRESS_LEN + 1)
|
#define MAX_ADDRESS_BUF (MAX_ADDRESS_LEN + 1)
|
||||||
#define MAX_NETSRCH_LEN 1024
|
#define MAX_NETSRCH_LEN 4096
|
||||||
#define MAX_NETSRCH_BUF (MAX_NETSRCH_LEN + 1)
|
#define MAX_NETSRCH_BUF (MAX_NETSRCH_LEN + 1)
|
||||||
#define MAX_NETRESP_LEN 3068
|
#define MAX_NETRESP_LEN 65536
|
||||||
#define MAX_NETRESP_BUF (MAX_NETRESP_BUF + 1)
|
#define MAX_NETRESP_BUF (MAX_NETRESP_BUF + 1)
|
||||||
// END
|
// END
|
||||||
#define TOKEN '%'
|
#define TOKEN '%'
|
||||||
|
@ -34,16 +34,22 @@ char *process_line(char *line)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(strncmp("exit", tok_srch, 4) == 0)
|
||||||
|
syn_error("ss:exit called");
|
||||||
|
|
||||||
/* print function */
|
/* print function */
|
||||||
else if(strncmp("print",tok_srch,5) == 0)
|
else if(strncmp("print",tok_srch,5) == 0)
|
||||||
{
|
{
|
||||||
char *parsed;
|
char *parsed;
|
||||||
tok_srch = strtok(NULL, "\"");
|
tok_srch = strtok(NULL, "\"");
|
||||||
|
if(strtok(NULL, "\"") == NULL)
|
||||||
|
syn_error("ss:error:print syntax error, missing quote?");
|
||||||
|
|
||||||
parsed = parse_vars(tok_srch);
|
parsed = parse_vars(tok_srch);
|
||||||
if(parsed != NULL)
|
if(parsed != NULL)
|
||||||
{
|
{
|
||||||
if(strtok(NULL, "\"") == NULL)
|
if(strtok(NULL, "\"") == NULL)
|
||||||
syn_error("ss:error:print syntax error, missing end quote");
|
syn_error("ss:error:print syntax error, missing end quote?");
|
||||||
|
|
||||||
return parsed;
|
return parsed;
|
||||||
}
|
}
|
||||||
@ -57,8 +63,10 @@ char *process_line(char *line)
|
|||||||
else if(strncmp("sleep",tok_srch,5) == 0)
|
else if(strncmp("sleep",tok_srch,5) == 0)
|
||||||
{
|
{
|
||||||
tok_srch = strtok(NULL, " ");
|
tok_srch = strtok(NULL, " ");
|
||||||
if(strcmp(tok_srch, "\n") == 0 ||
|
if(tok_srch == NULL)
|
||||||
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
syn_error("ss:error:sleep syntax error, need trailing integer for operation");
|
||||||
|
|
||||||
|
if(strcmp(tok_srch, "\n") == 0 || strcmp(tok_srch, " \n") == 0)
|
||||||
syn_error("ss:error:sleep syntax error, need trailing integer for operation");
|
syn_error("ss:error:sleep syntax error, need trailing integer for operation");
|
||||||
|
|
||||||
/* if there is a new line, remove it */
|
/* if there is a new line, remove it */
|
||||||
@ -76,9 +84,12 @@ char *process_line(char *line)
|
|||||||
char srch[MAX_NETSRCH_BUF];
|
char srch[MAX_NETSRCH_BUF];
|
||||||
char port[7]; // Should never be more than 6 characters
|
char port[7]; // Should never be more than 6 characters
|
||||||
tok_srch = strtok(NULL, "\"");
|
tok_srch = strtok(NULL, "\"");
|
||||||
|
if(strtok(NULL, "\"") == NULL)
|
||||||
|
syn_error("ss:error:netlisten syntax error, missing quote?");
|
||||||
|
|
||||||
if(strcmp(tok_srch, "\n") == 0 ||
|
if(strcmp(tok_srch, "\n") == 0 ||
|
||||||
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
||||||
syn_error("ss:error:sleep syntax error, need trailing integer for operation");
|
syn_error("ss:error:netlisten syntax error, missing quote?");
|
||||||
|
|
||||||
if(strlen(parse_vars(tok_srch)) < 7)
|
if(strlen(parse_vars(tok_srch)) < 7)
|
||||||
{
|
{
|
||||||
@ -160,10 +171,13 @@ char *process_line(char *line)
|
|||||||
char port[7];
|
char port[7];
|
||||||
/* strtok to filename of function */
|
/* strtok to filename of function */
|
||||||
tok_srch = strtok(NULL, "\"");
|
tok_srch = strtok(NULL, "\"");
|
||||||
|
if(strtok(NULL, "\"") == NULL)
|
||||||
|
syn_error("ss:error:netconnect syntax error, missing quote?");
|
||||||
|
|
||||||
/* Check to see if syntax is correct */
|
/* Check to see if syntax is correct */
|
||||||
if(strcmp(tok_srch, "\n") == 0 ||
|
if(strcmp(tok_srch, "\n") == 0 ||
|
||||||
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
||||||
syn_error("ss:error:netconnect syntax error, requires address followed by port; both in quotes");
|
syn_error("ss:error:netconnect syntax error, missing quote?");
|
||||||
|
|
||||||
/* open file */
|
/* open file */
|
||||||
strcpy(address, parse_vars(tok_srch));
|
strcpy(address, parse_vars(tok_srch));
|
||||||
@ -198,10 +212,13 @@ char *process_line(char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ss encrypt function */
|
/* ss encrypt function */
|
||||||
else if(strncmp("encrypt",tok_srch,7) == 0)
|
else if(strncmp("encrypt",tok_srch,7) == 0 || strncmp("encode", tok_srch,6) == 0)
|
||||||
{
|
{
|
||||||
char *var_conv;
|
char *var_conv;
|
||||||
tok_srch = strtok(NULL, "\"");
|
tok_srch = strtok(NULL, "\"");
|
||||||
|
if(strtok(NULL, "\"") == NULL)
|
||||||
|
syn_error("ss:error:encode syntax error, requires data in quotes");
|
||||||
|
|
||||||
if(strcmp(tok_srch, "\n") == 0 ||
|
if(strcmp(tok_srch, "\n") == 0 ||
|
||||||
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
||||||
syn_error("ss:error:encode syntax error, requires data in quotes");
|
syn_error("ss:error:encode syntax error, requires data in quotes");
|
||||||
@ -216,10 +233,13 @@ char *process_line(char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ss decrypt function */
|
/* ss decrypt function */
|
||||||
else if(strncmp("decrypt",tok_srch,7) == 0)
|
else if(strncmp("decrypt",tok_srch,7) == 0 || strncmp("decode", tok_srch,6) == 0)
|
||||||
{
|
{
|
||||||
char *var_conv;
|
char *var_conv;
|
||||||
tok_srch = strtok(NULL, "\"");
|
tok_srch = strtok(NULL, "\"");
|
||||||
|
if(strtok(NULL, "\"") == NULL)
|
||||||
|
syn_error("ss:error:decode syntax error, requires data in quotes");
|
||||||
|
|
||||||
if(strcmp(tok_srch, "\n") == 0 ||
|
if(strcmp(tok_srch, "\n") == 0 ||
|
||||||
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
||||||
syn_error("ss:error:decode syntax error, requires data in quotes");
|
syn_error("ss:error:decode syntax error, requires data in quotes");
|
||||||
@ -239,9 +259,12 @@ char *process_line(char *line)
|
|||||||
char *file_line, *catfile, *file_md5_val;
|
char *file_line, *catfile, *file_md5_val;
|
||||||
|
|
||||||
tok_srch = strtok(NULL, "\"");
|
tok_srch = strtok(NULL, "\"");
|
||||||
|
if(strtok(NULL, "\"") == NULL)
|
||||||
|
syn_error("ss:error:md5 syntax error, requires a file argument in quotes");
|
||||||
|
|
||||||
if(strcmp(tok_srch, "\n") == 0 ||
|
if(strcmp(tok_srch, "\n") == 0 ||
|
||||||
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
||||||
syn_error("ss:error:exec syntax error, requires a file argument in quotes");
|
syn_error("ss:error:md5 syntax error, requires a file argument in quotes");
|
||||||
|
|
||||||
file_line = parse_vars(tok_srch);
|
file_line = parse_vars(tok_srch);
|
||||||
file_md5_val = md5_file(file_line);
|
file_md5_val = md5_file(file_line);
|
||||||
@ -265,6 +288,9 @@ char *process_line(char *line)
|
|||||||
char *cmd_line;
|
char *cmd_line;
|
||||||
int return_val;
|
int return_val;
|
||||||
tok_srch = strtok(NULL, "\"");
|
tok_srch = strtok(NULL, "\"");
|
||||||
|
if(strtok(NULL, "\"") == NULL)
|
||||||
|
syn_error("ss:error:exec syntax error, requires a file argument in quotes");
|
||||||
|
|
||||||
if(strcmp(tok_srch, "\n") == 0 ||
|
if(strcmp(tok_srch, "\n") == 0 ||
|
||||||
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
||||||
syn_error("ss:error:exec syntax error, requires argument in quotes");
|
syn_error("ss:error:exec syntax error, requires argument in quotes");
|
||||||
@ -286,6 +312,9 @@ char *process_line(char *line)
|
|||||||
FILE* write_file = NULL;
|
FILE* write_file = NULL;
|
||||||
/* strtok to filename of function */
|
/* strtok to filename of function */
|
||||||
tok_srch = strtok(NULL, "\"");
|
tok_srch = strtok(NULL, "\"");
|
||||||
|
if(strtok(NULL, "\"") == NULL)
|
||||||
|
syn_error("ss:error:write syntax error, requires a file argument in quotes");
|
||||||
|
|
||||||
/* Check to see if syntax is correct */
|
/* Check to see if syntax is correct */
|
||||||
if(strcmp(tok_srch, "\n") == 0 ||
|
if(strcmp(tok_srch, "\n") == 0 ||
|
||||||
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
||||||
@ -328,6 +357,9 @@ char *process_line(char *line)
|
|||||||
|
|
||||||
/* strtok to filename of function */
|
/* strtok to filename of function */
|
||||||
tok_srch = strtok(NULL, "\"");
|
tok_srch = strtok(NULL, "\"");
|
||||||
|
if(strtok(NULL, "\"") == NULL)
|
||||||
|
syn_error("ss:error:read syntax error, requires a file argument in quotes");
|
||||||
|
|
||||||
if(strcmp(tok_srch, "\n") == 0 ||
|
if(strcmp(tok_srch, "\n") == 0 ||
|
||||||
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
strcmp(tok_srch, " \n") == 0 || tok_srch == NULL)
|
||||||
syn_error("ss:error:read syntax error, missing filename / in quotes");
|
syn_error("ss:error:read syntax error, missing filename / in quotes");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user