Fix some of the Errors/warnings detected by checkapi.
authorAnders Broman <anders.broman@ericsson.com>
Tue, 13 May 2008 07:26:20 +0000 (07:26 -0000)
committerAnders Broman <anders.broman@ericsson.com>
Tue, 13 May 2008 07:26:20 +0000 (07:26 -0000)
svn path=/trunk/; revision=25284

text2pcap.c
trigcap.c

index 829b205dbc2a801395989bbeb3448841f215803b..c62aa7490a9bad0595146d4a335f2418d127bf67 100644 (file)
@@ -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",
index 020ce3561eb7f5e774fc3f1bf5f6b989d2e01d5b..9eef95c84e430db2630b532762db2dd92442f3f6 100644 (file)
--- a/trigcap.c
+++ b/trigcap.c
@@ -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;