diff options
-rw-r--r-- | text2pcap.c | 8 | ||||
-rw-r--r-- | trigcap.c | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/text2pcap.c b/text2pcap.c index 829b205dbc..c62aa7490a 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -704,12 +704,12 @@ append_to_preamble(char *str) if (toklen != 0) { if (packet_preamble_len + toklen > PACKET_PREAMBLE_MAX_LEN) return; /* no room to add the token to the preamble */ - strncpy(&packet_preamble[packet_preamble_len], str, PACKET_PREAMBLE_MAX_LEN - packet_preamble_len); + g_strlcpy(&packet_preamble[packet_preamble_len], str, PACKET_PREAMBLE_MAX_LEN); packet_preamble_len += toklen; if (debug >= 2) { char *c; char xs[PACKET_PREAMBLE_MAX_LEN]; - strncpy(xs, packet_preamble, PACKET_PREAMBLE_MAX_LEN); + g_strlcpy(xs, packet_preamble, PACKET_PREAMBLE_MAX_LEN); while ((c = strchr(xs, '\r')) != NULL) *c=' '; fprintf (stderr, "[[append_to_preamble: \"%s\"]]", xs); } @@ -1263,7 +1263,7 @@ parse_options (int argc, char *argv[]) } if (strcmp(argv[optind], "-")) { - input_filename = strdup(argv[optind]); + input_filename = g_strdup(argv[optind]); input_file = eth_fopen(input_filename, "rb"); if (!input_file) { fprintf(stderr, "Cannot open file [%s] for reading: %s\n", @@ -1276,7 +1276,7 @@ parse_options (int argc, char *argv[]) } if (strcmp(argv[optind+1], "-")) { - output_filename = strdup(argv[optind+1]); + output_filename = g_strdup(argv[optind+1]); output_file = eth_fopen(output_filename, "wb"); if (!output_file) { fprintf(stderr, "Cannot open file [%s] for writing: %s\n", @@ -131,11 +131,11 @@ int main(int argc, char** argv) { switch (opt) { case 'i': if (interface) panic(1,"interface already given"); - interface = strdup(optarg); + interface = g_strdup(optarg); break; case 'w': if (outfile) panic(3,"output file already given"); - outfile = strdup(optarg); + outfile = g_strdup(optarg); break; case 's': snaplen = strtoul(optarg,NULL,10); @@ -144,15 +144,15 @@ int main(int argc, char** argv) { break; case 'b': if (start_filter_str) panic(5,"start filter already given"); - start_filter_str = strdup(optarg); + start_filter_str = g_strdup(optarg); break; case 'e': if (stop_filter_str) panic(6,"stop filter already given"); - stop_filter_str = strdup(optarg); + stop_filter_str = g_strdup(optarg); break; case 'f': if (capture_filter_str) panic(7,"capture filter already given"); - capture_filter_str = strdup(optarg); + capture_filter_str = g_strdup(optarg); break; case 'p': promisc = 1; |