Still fixing 64-bit int/long int buggy casts

This commit is contained in:
BlackLight 2011-02-09 03:22:17 +01:00
parent ba1fa96fae
commit 039a82a71f
6 changed files with 14 additions and 14 deletions

2
geo.c
View file

@ -90,7 +90,7 @@ AI_geoinfobyaddr ( const char *ip, double **coord )
fprintf ( fp, fprintf ( fp,
"POST /index.html HTTP/1.1\r\n" "POST /index.html HTTP/1.1\r\n"
"Host: www.hostip.info\r\n" "Host: www.hostip.info\r\n"
"Content-Length: %u\r\n" "Content-Length: %lu\r\n"
"Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n" "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n"
"Connection: close\r\n\r\n" "Connection: close\r\n\r\n"
"%s\r\n", "%s\r\n",

12
kb.c
View file

@ -44,7 +44,7 @@ PRIVATE AI_hyperalert_info *hyperalerts = NULL;
PRIVATE char* PRIVATE char*
__AI_get_function_name ( const char *orig_stmt ) __AI_get_function_name ( const char *orig_stmt )
{ {
int parenthesis_pos, function_name_len; unsigned long int parenthesis_pos, function_name_len;
char function_name[4096]; char function_name[4096];
char *stmt = NULL; char *stmt = NULL;
@ -54,10 +54,10 @@ __AI_get_function_name ( const char *orig_stmt )
memset ( function_name, 0, sizeof ( function_name )); memset ( function_name, 0, sizeof ( function_name ));
if ( !( parenthesis_pos = (int) strstr ( stmt, "(" ))) if ( !( parenthesis_pos = (unsigned long int) strstr ( stmt, "(" )))
return NULL; return NULL;
parenthesis_pos -= (int) stmt; parenthesis_pos -= (unsigned long int) stmt;
function_name_len = ( parenthesis_pos < sizeof ( function_name )) ? parenthesis_pos : sizeof ( function_name ); function_name_len = ( parenthesis_pos < sizeof ( function_name )) ? parenthesis_pos : sizeof ( function_name );
strncpy ( function_name, stmt, function_name_len ); strncpy ( function_name, stmt, function_name_len );
@ -78,17 +78,17 @@ __AI_get_function_arguments ( char *orig_stmt, int *n_args )
char **args = NULL; char **args = NULL;
char *tok = NULL; char *tok = NULL;
char *stmt = NULL; char *stmt = NULL;
int par_pos = 0; unsigned long int par_pos = 0;
*n_args = 0; *n_args = 0;
if ( !( stmt = (char*) alloca ( strlen ( orig_stmt )))) if ( !( stmt = (char*) alloca ( strlen ( orig_stmt ))))
return NULL; return NULL;
strcpy ( stmt, orig_stmt ); strcpy ( stmt, orig_stmt );
if ( !( par_pos = (int) strstr ( stmt, "(" ))) if ( !( par_pos = (unsigned long int) strstr ( stmt, "(" )))
return NULL; return NULL;
par_pos -= (int) stmt; par_pos -= (unsigned long int) stmt;
stmt += par_pos + 1; stmt += par_pos + 1;
if ( stmt [ strlen(stmt) - 1 ] == ')' ) if ( stmt [ strlen(stmt) - 1 ] == ')' )

View file

@ -164,7 +164,7 @@ str_replace ( char *str, char *orig, char *rep )
unsigned long int new_len = 0; unsigned long int new_len = 0;
unsigned long int pos = 0; unsigned long int pos = 0;
if ( !( pos = (int) strstr ( str, orig ))) if ( !( pos = (unsigned long int) strstr ( str, orig )))
return str; return str;
new_len = strlen(str) - strlen(orig) + ((rep) ? strlen(rep) : 0) + 1; new_len = strlen(str) - strlen(orig) + ((rep) ? strlen(rep) : 0) + 1;

View file

@ -186,8 +186,8 @@ static AI_config * AI_parse(char *args)
int nmatches = 0; int nmatches = 0;
int i; int i;
int offset;
int len; int len;
unsigned long int offset;
double corr_threshold_coefficient = DEFAULT_CORR_THRESHOLD; double corr_threshold_coefficient = DEFAULT_CORR_THRESHOLD;
uint32_t netmask; uint32_t netmask;
@ -1174,7 +1174,7 @@ static AI_config * AI_parse(char *args)
type = none; type = none;
match = strdup ( matches[1] ); match = strdup ( matches[1] );
offset = (int) strcasestr ( args, matches[0] ) - (int) args; offset = (unsigned long int) strcasestr ( args, matches[0] ) - (unsigned long int) args;
len = strlen ( matches[0] ); len = strlen ( matches[0] );
for ( i=0; i < nmatches; i++ ) for ( i=0; i < nmatches; i++ )
@ -1339,7 +1339,7 @@ static AI_config * AI_parse(char *args)
} }
} }
for ( i=offset; i <= strlen(args); i++ ) for ( i = (int) offset; i <= strlen(args); i++ )
args[i] = args[ i+len ]; args[i] = args[ i+len ];
if ( min_val == -1 || max_val == -1 || type == none || strlen ( label ) == 0 ) if ( min_val == -1 || max_val == -1 || type == none || strlen ( label ) == 0 )

View file

@ -268,7 +268,7 @@ AI_pkt_enqueue ( SFSnortPacket* pkt )
for ( ; found->next; found = found->next ) { for ( ; found->next; found = found->next ) {
/* Stupid memory bug fixed in a stupid and unelegant way */ /* Stupid memory bug fixed in a stupid and unelegant way */
if ( (int) found->next->pkt < 0x100 ) if ( (unsigned long int) found->next->pkt < 0x100 )
break; break;
/* If the sequence number of the next packet in the stream /* If the sequence number of the next packet in the stream

View file

@ -33,7 +33,7 @@
"Date: %s\r\n" \ "Date: %s\r\n" \
"Server: %s\r\n" \ "Server: %s\r\n" \
"Content-Type: %s\r\n" \ "Content-Type: %s\r\n" \
"Content-Length: %u\r\n\r\n" "Content-Length: %lu\r\n\r\n"
#define HTTP_CGI_RESPONSE_HEADERS_FORMAT "%s %d %s\r\n" \ #define HTTP_CGI_RESPONSE_HEADERS_FORMAT "%s %d %s\r\n" \
"Date: %s\r\n" \ "Date: %s\r\n" \
@ -42,7 +42,7 @@
#define HTTP_ERR_RESPONSE_FORMAT "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" \ #define HTTP_ERR_RESPONSE_FORMAT "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" \
"<html><head>\n" \ "<html><head>\n" \
"<title>%u %s</title>\n" \ "<title>%lu %s</title>\n" \
"</head><body>\n" \ "</head><body>\n" \
"<h1>%s</h1>\n" \ "<h1>%s</h1>\n" \
"<p>%s</p>\n" \ "<p>%s</p>\n" \