... | ... |
@@ -35,7 +35,7 @@ const char *cst_cnx_file_details_list[]= |
35 | 35 |
|
36 | 36 |
bool is_number(const char*s) { |
37 | 37 |
char* e = NULL; |
38 |
- uint32_t val = strtol(s, &e, 0); |
|
38 |
+ strtol(s, &e, 0); |
|
39 | 39 |
return e != NULL && *e == (char)0; |
40 | 40 |
} |
41 | 41 |
|
... | ... |
@@ -173,6 +173,9 @@ int _addprocinfo(const char *filename) { |
173 | 173 |
return 0; |
174 | 174 |
|
175 | 175 |
char *ret = fgets(buffer, sizeof(buffer), procinfo); |
176 |
+ if( NULL == ret ) { |
|
177 |
+ return 0; |
|
178 |
+ } |
|
176 | 179 |
|
177 | 180 |
do { |
178 | 181 |
if (fgets(buffer, sizeof(buffer), procinfo)) |
... | ... |
@@ -73,8 +73,8 @@ void pcap_loop_cb(u_char *useless,const struct pcap_pkthdr* header,const u_char* |
73 | 73 |
} |
74 | 74 |
|
75 | 75 |
sniff_ip_t *ip_header = (sniff_ip_t*)(packet+ETHER_HEADER_SIZE); |
76 |
- char str_ip_src[STR_IP4_SIZE]=""; |
|
77 |
- char str_ip_dst[STR_IP4_SIZE]=""; |
|
76 |
+ char str_ip_src[STR_IP4_SIZE+1]=""; |
|
77 |
+ char str_ip_dst[STR_IP4_SIZE+1]=""; |
|
78 | 78 |
strncpy(str_ip_src,inet_ntoa(ip_header->ip_src),STR_IP4_SIZE); |
79 | 79 |
strncpy(str_ip_dst,inet_ntoa(ip_header->ip_dst),STR_IP4_SIZE); |
80 | 80 |
|