diff options
-rw-r--r-- | editcap.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-cops.c | 9 | ||||
-rw-r--r-- | epan/filesystem.c | 18 | ||||
-rw-r--r-- | epan/prefs.c | 2 | ||||
-rw-r--r-- | print.c | 4 | ||||
-rw-r--r-- | strerror.c | 2 | ||||
-rw-r--r-- | tap-afpstat.c | 3 | ||||
-rw-r--r-- | tap-bootpstat.c | 3 | ||||
-rw-r--r-- | tap-camelcounter.c | 3 | ||||
-rw-r--r-- | tap-camelsrt.c | 3 | ||||
-rw-r--r-- | tap-dcerpcstat.c | 3 | ||||
-rw-r--r-- | tap-h225counter.c | 3 | ||||
-rw-r--r-- | tap-h225rassrt.c | 3 | ||||
-rw-r--r-- | tap-httpstat.c | 3 | ||||
-rw-r--r-- | tap-iostat.c | 3 | ||||
-rw-r--r-- | tap-mgcpstat.c | 3 | ||||
-rw-r--r-- | tap-protohierstat.c | 3 | ||||
-rw-r--r-- | tap-radiusstat.c | 13 | ||||
-rw-r--r-- | tap-rpcstat.c | 3 | ||||
-rw-r--r-- | tap-sctpchunkstat.c | 3 | ||||
-rw-r--r-- | tap-smbstat.c | 3 | ||||
-rw-r--r-- | tap-wspstat.c | 3 | ||||
-rw-r--r-- | tempfile.c | 11 | ||||
-rw-r--r-- | text2pcap.c | 4 | ||||
-rw-r--r-- | tshark.c | 5 | ||||
-rw-r--r-- | util.c | 6 | ||||
-rw-r--r-- | wiretap/catapult_dct2000.c | 4 | ||||
-rw-r--r-- | wiretap/network_instruments.c | 4 | ||||
-rw-r--r-- | wiretap/visual.c | 2 | ||||
-rw-r--r-- | wiretap/wtap.c | 4 |
30 files changed, 55 insertions, 86 deletions
@@ -394,6 +394,7 @@ int main(int argc, char *argv[]) int split_packet_count = 0; int written_count = 0; char *filename; + size_t filenamelen; gboolean check_ts; #ifdef HAVE_PLUGINS char* init_progfile_dir_error; @@ -618,11 +619,12 @@ int main(int argc, char *argv[]) out_frame_type = wtap_file_encap(wth); if (split_packet_count > 0) { - filename = (char *) g_malloc(strlen(argv[optind+1]) + 20); + filenamelen = strlen(argv[optind+1]) + 20; + filename = (char *) g_malloc(filenamelen); if (!filename) { exit(5); } - sprintf(filename, "%s-%05d", argv[optind+1], 0); + snprintf(filename, filenamelen, "%s-%05d", argv[optind+1], 0); } else { filename = argv[optind+1]; } @@ -651,7 +653,7 @@ int main(int argc, char *argv[]) exit(1); } - sprintf(filename, "%s-%05d",argv[optind+1], count / split_packet_count); + snprintf(filename, filenamelen, "%s-%05d",argv[optind+1], count / split_packet_count); if (verbose) { fprintf(stderr, "Continuing writing in file %s\n", filename); diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c index 181fa50bea..3d73e32283 100644 --- a/epan/dissectors/packet-cops.c +++ b/epan/dissectors/packet-cops.c @@ -2634,9 +2634,8 @@ cops_transaction_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *st, guint8 op val_to_str(code16,table_cops_dqos_transaction_id, "Unknown (0x%04x)"),code16); /* Write the right data into the 'info field' on the Gui */ - g_snprintf(info,sizeof(info),"COPS %-20s - ",val_to_str(op_code,cops_op_code_vals, "Unknown")); - strncat(info,val_to_str(code16,table_cops_dqos_transaction_id, "Unknown"), sizeof(info)-strlen(info)); - info[sizeof(info)-1] = '\0'; + g_snprintf(info,sizeof(info),"COPS %-20s - %s",val_to_str(op_code,cops_op_code_vals, "Unknown"), + val_to_str(code16,table_cops_dqos_transaction_id, "Unknown")); if (check_col(pinfo->cinfo, COL_INFO)) { col_clear(pinfo->cinfo, COL_INFO); @@ -3031,8 +3030,8 @@ cops_mm_transaction_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *st, guint8 val_to_str(code16,table_cops_mm_transaction_id, "Unknown (0x%04x)"),code16); /* Write the right data into the 'info field' on the Gui */ - g_snprintf(info,sizeof(info),"COPS %-20s - ",val_to_str(op_code,cops_op_code_vals, "Unknown")); - strncat(info,val_to_str(code16,table_cops_mm_transaction_id, "Unknown"), sizeof(info)-strlen(info)); + g_snprintf(info,sizeof(info),"COPS %-20s - %s",val_to_str(op_code,cops_op_code_vals, "Unknown"), + val_to_str(code16,table_cops_mm_transaction_id, "Unknown")); if (check_col(pinfo->cinfo, COL_INFO)) { col_clear(pinfo->cinfo, COL_INFO); diff --git a/epan/filesystem.c b/epan/filesystem.c index 7ad214e9a2..9194226aef 100644 --- a/epan/filesystem.c +++ b/epan/filesystem.c @@ -386,10 +386,7 @@ init_progfile_dir(const char *arg0 return g_strdup_printf("getcwd failed: %s\n", strerror(errno)); } - path = g_malloc(strlen(curdir) + 1 + strlen(arg0) + 1); - strcpy(path, curdir); - strcat(path, "/"); - strcat(path, arg0); + path = g_strdup_printf("%s/%s", curdir, arg0); g_free(curdir); prog_pathname = path; } else { @@ -411,8 +408,8 @@ init_progfile_dir(const char *arg0 + strlen(arg0) + 1); memcpy(path, path_start, path_component_len); path[path_component_len] = '\0'; - strcat(path, "/"); - strcat(path, arg0); + strncat(path, "/", 2); + strncat(path, arg0, strlen(arg0) + 1); if (access(path, X_OK) == 0) { /* * Found it! @@ -1140,9 +1137,7 @@ get_persdatafile_dir(void) /* the "My Captures" sub-directory is created (if it doesn't exist) by u3util.exe when the U3 Wireshark is first run */ - szPath = g_malloc(strlen(u3devicedocumentpath) + strlen(U3_MY_CAPTURES) + 1); - strcpy(szPath, u3devicedocumentpath); - strcat(szPath, U3_MY_CAPTURES); + szPath = g_strdup_printf("%s%s", 3devicedocumentpath, U3_MY_CAPTURES); persdatafile_dir = szPath; return szPath; @@ -1192,10 +1187,7 @@ get_home_dir(void) * This is cached, so we don't need to worry about * allocating multiple ones of them. */ - homestring = - g_malloc(strlen(homedrive) + strlen(homepath) + 1); - strcpy(homestring, homedrive); - strcat(homestring, homepath); + homestring = g_strdup_printf("%s%s", homedrive, homepath); /* * Trim off any trailing slash or backslash. diff --git a/epan/prefs.c b/epan/prefs.c index c5591d52b3..babcaae1a0 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -961,7 +961,7 @@ put_string_list(GList *sl) pref_str[cur_len] = '\n'; cur_len++; pref_str[cur_len] = '\t'; cur_len++; } - sprintf(&pref_str[cur_len], "\"%s\", ", quoted_str); + g_snprintf(&pref_str[cur_len], MAX_FMT_PREF_LEN - cur_len, "\"%s\", ", quoted_str); cur_pos += fmt_len; cur_len += fmt_len; } @@ -718,9 +718,7 @@ print_hex_data(print_stream_t *stream, epan_dissect_t *edt) if (multiple_sources) { name = src->name; print_line(stream, 0, ""); - line = g_malloc(strlen(name) + 2); /* <name>:\0 */ - strcpy(line, name); - strcat(line, ":"); + line = g_strdup_printf("%s:", name); print_line(stream, 0, line); g_free(line); } diff --git a/strerror.c b/strerror.c index 93cc02b9a3..34dcad88bb 100644 --- a/strerror.c +++ b/strerror.c @@ -35,7 +35,7 @@ strerror(int errnum) static char errbuf[5+1+11+1]; /* "Error %d" */ if (errnum < 0 || errnum >= sys_nerr) { - sprintf(errbuf, "Error %d", errnum); + g_snprintf(errbuf, 18, "Error %d", errnum); return errbuf; } else return sys_errlist[errnum]; diff --git a/tap-afpstat.c b/tap-afpstat.c index 43bffbc5b9..16dff8118d 100644 --- a/tap-afpstat.c +++ b/tap-afpstat.c @@ -128,8 +128,7 @@ afpstat_init(const char *optarg, void* userdata _U_) ss=g_malloc(sizeof(afpstat_t)); if(filter){ - ss->filter=g_malloc(strlen(filter)+1); - strcpy(ss->filter, filter); + ss->filter=g_strdup(filter); } else { ss->filter=NULL; } diff --git a/tap-bootpstat.c b/tap-bootpstat.c index 83d304091a..1f23e44101 100644 --- a/tap-bootpstat.c +++ b/tap-bootpstat.c @@ -152,8 +152,7 @@ dhcpstat_init(const char *optarg, void* userdata _U_) sp = g_malloc( sizeof(dhcpstat_t) ); sp->hash = g_hash_table_new( g_str_hash, g_str_equal); if(filter){ - sp->filter=g_malloc(strlen(filter)+1); - strcpy(sp->filter,filter); + sp->filter=g_strdup(filter); } else { sp->filter=NULL; } diff --git a/tap-camelcounter.c b/tap-camelcounter.c index fa489c1ace..0368465bcd 100644 --- a/tap-camelcounter.c +++ b/tap-camelcounter.c @@ -104,8 +104,7 @@ static void camelcounter_init(const char *optarg, void* userdata _U_) p_camelcounter = g_malloc(sizeof(struct camelcounter_t)); if(filter){ - p_camelcounter->filter=g_malloc(strlen(filter)+1); - strcpy(p_camelcounter->filter,filter); + p_camelcounter->filter=g_strdup(filter); } else { p_camelcounter->filter=NULL; } diff --git a/tap-camelsrt.c b/tap-camelsrt.c index 19bfbabc44..a16635197e 100644 --- a/tap-camelsrt.c +++ b/tap-camelsrt.c @@ -222,8 +222,7 @@ static void camelsrt_init(const char *optarg, void* userdata _U_) p_camelsrt = g_malloc(sizeof(struct camelsrt_t)); if(filter){ - p_camelsrt->filter=g_malloc(strlen(filter)+1); - strcpy(p_camelsrt->filter,filter); + p_camelsrt->filter=g_strdup(filter); } else { p_camelsrt->filter=NULL; } diff --git a/tap-dcerpcstat.c b/tap-dcerpcstat.c index 1c4342975e..7bee236b7c 100644 --- a/tap-dcerpcstat.c +++ b/tap-dcerpcstat.c @@ -249,8 +249,7 @@ dcerpcstat_init(const char *optarg, void* userdata _U_) rs->ver=ver; if(filter){ - rs->filter=g_malloc(strlen(filter)+1); - strcpy(rs->filter, filter); + rs->filter=g_strdup(filter); } else { rs->filter=NULL; } diff --git a/tap-h225counter.c b/tap-h225counter.c index 5e6388b62d..bafc80ba32 100644 --- a/tap-h225counter.c +++ b/tap-h225counter.c @@ -363,8 +363,7 @@ h225counter_init(const char *optarg, void* userdata _U_) } hs = g_malloc(sizeof(h225counter_t)); - hs->filter=g_malloc(strlen(filter)+1); - strcpy(hs->filter, filter); + hs->filter=g_strdup(filter); h225counter_reset(hs); diff --git a/tap-h225rassrt.c b/tap-h225rassrt.c index 97ad22883f..385ccc4cf0 100644 --- a/tap-h225rassrt.c +++ b/tap-h225rassrt.c @@ -226,8 +226,7 @@ h225rassrt_init(const char *optarg, void* userdata _U_) } hs = g_malloc(sizeof(h225rassrt_t)); - hs->filter=g_malloc(strlen(filter)+1); - strcpy(hs->filter, filter); + hs->filter=g_strdup(filter); h225rassrt_reset(hs); diff --git a/tap-httpstat.c b/tap-httpstat.c index 073a35d925..7a611a9587 100644 --- a/tap-httpstat.c +++ b/tap-httpstat.c @@ -295,8 +295,7 @@ gtk_httpstat_init(const char *optarg,void* userdata _U_) sp = g_malloc( sizeof(httpstat_t) ); if(filter){ - sp->filter=g_malloc(strlen(filter)+1); - strcpy(sp->filter,filter); + sp->filter=g_strdup(filter); } else { sp->filter=NULL; } diff --git a/tap-iostat.c b/tap-iostat.c index 5833a46bf5..225af8254d 100644 --- a/tap-iostat.c +++ b/tap-iostat.c @@ -663,8 +663,7 @@ iostat_init(const char *optarg, void* userdata _U_) if(pos==str){ register_io_tap(io, i, NULL); } else if(pos==NULL) { - tmp=g_malloc(strlen(str)+1); - strcpy(tmp,str); + tmp=g_strdup(str); register_io_tap(io, i, tmp); } else { tmp=g_malloc((pos-str)+1); diff --git a/tap-mgcpstat.c b/tap-mgcpstat.c index 5d5d96236f..967f9d9260 100644 --- a/tap-mgcpstat.c +++ b/tap-mgcpstat.c @@ -195,8 +195,7 @@ mgcpstat_init(const char *optarg, void* userdata _U_) } ms=g_malloc(sizeof(mgcpstat_t)); - ms->filter=g_malloc(strlen(filter)+1); - strcpy(ms->filter, filter); + ms->filter=g_strdup(filter); for(i=0;i<NUM_TIMESTATS;i++) { ms->rtd[i].num=0; diff --git a/tap-protohierstat.c b/tap-protohierstat.c index 415c2f0d71..7f897b930a 100644 --- a/tap-protohierstat.c +++ b/tap-protohierstat.c @@ -200,8 +200,7 @@ protohierstat_init(const char *optarg, void* userdata _U_) rs=new_phs_t(NULL); if(filter){ - rs->filter=g_malloc(strlen(filter)+1); - strcpy(rs->filter, filter); + rs->filter=g_strdup(filter); } else { rs->filter=NULL; } diff --git a/tap-radiusstat.c b/tap-radiusstat.c index 56f5979202..1730c04e42 100644 --- a/tap-radiusstat.c +++ b/tap-radiusstat.c @@ -184,19 +184,18 @@ radiusstat_init(const char *optarg, void* userdata _U_) } rs=g_malloc(sizeof(radiusstat_t)); - rs->filter=g_malloc(strlen(filter)+1); - strcpy(rs->filter, filter); + rs->filter=g_strdup(filter); for(i=0;i<NUM_TIMESTATS;i++) { rs->rtd[i].num=0; rs->rtd[i].min_num=0; rs->rtd[i].max_num=0; rs->rtd[i].min.secs=0; - rs->rtd[i].min.nsecs=0; - rs->rtd[i].max.secs=0; - rs->rtd[i].max.nsecs=0; - rs->rtd[i].tot.secs=0; - rs->rtd[i].tot.nsecs=0; + rs->rtd[i].min.nsecs=0; + rs->rtd[i].max.secs=0; + rs->rtd[i].max.nsecs=0; + rs->rtd[i].tot.secs=0; + rs->rtd[i].tot.nsecs=0; } rs->open_req_num=0; diff --git a/tap-rpcstat.c b/tap-rpcstat.c index b544abf50d..617ad77fa3 100644 --- a/tap-rpcstat.c +++ b/tap-rpcstat.c @@ -293,8 +293,7 @@ rpcstat_init(const char *optarg, void* userdata _U_) rs->program=program; rs->version=version; if(filter){ - rs->filter=g_malloc(strlen(filter)+1); - strcpy(rs->filter, filter); + rs->filter=g_strdup(filter); } else { rs->filter=NULL; } diff --git a/tap-sctpchunkstat.c b/tap-sctpchunkstat.c index de060d53fd..630d4f4c91 100644 --- a/tap-sctpchunkstat.c +++ b/tap-sctpchunkstat.c @@ -233,10 +233,9 @@ sctpstat_init(const char *optarg, void* userdata _U_) } hs = g_malloc(sizeof(sctpstat_t)); - hs->filter=g_malloc(strlen(filter)+1); + hs->filter=g_strdup(filter); hs->ep_list = NULL; hs->number_of_packets = 0; - strcpy(hs->filter, filter); sctpstat_reset(hs); diff --git a/tap-smbstat.c b/tap-smbstat.c index aa0a2828be..5ddfaf65df 100644 --- a/tap-smbstat.c +++ b/tap-smbstat.c @@ -215,8 +215,7 @@ smbstat_init(const char *optarg,void* userdata _U_) ss=g_malloc(sizeof(smbstat_t)); if(filter){ - ss->filter=g_malloc(strlen(filter)+1); - strcpy(ss->filter, filter); + ss->filter=g_strdup(filter); } else { ss->filter=NULL; } diff --git a/tap-wspstat.c b/tap-wspstat.c index 8080560b9f..782ac82d34 100644 --- a/tap-wspstat.c +++ b/tap-wspstat.c @@ -247,8 +247,7 @@ wspstat_init(const char *optarg, void* userdata _U_) sp->num_pdus = 16; sp->pdu_stats=g_malloc( (sp->num_pdus+1) * sizeof( wsp_pdu_t) ); if(filter){ - sp->filter=g_malloc(strlen(filter)+1); - strcpy(sp->filter,filter); + sp->filter=g_strdup(filter); } else { sp->filter=NULL; } diff --git a/tempfile.c b/tempfile.c index 61495281ce..af922b6d41 100644 --- a/tempfile.c +++ b/tempfile.c @@ -57,9 +57,7 @@ setup_tmpdir(const char *dir) return dir; } else { - newdir = g_malloc(len + 2); - strcpy(newdir, dir); - strcat(newdir, G_DIR_SEPARATOR_S); + newdir = g_strdup_printf("%s%s", dir, G_DIR_SEPARATOR_S); return newdir; } } @@ -72,17 +70,14 @@ try_tempfile(char *namebuf, int namebuflen, const char *dir, const char *pfx) int old_umask; int tmp_fd; + g_snprintf(namebuf, namebuflen, "%s%s%s", dir, pfx, suffix); if (namebuflen < namelen) { - /* Stick in a truncated name, so that if this error is + /* Stick with the truncated name, so that if this error is reported with the file name, you at least get something. */ - g_snprintf(namebuf, namebuflen, "%s%s%s", dir, pfx, suffix); errno = ENAMETOOLONG; return -1; } - strcpy(namebuf, dir); - strcat(namebuf, pfx); - strcat(namebuf, suffix); /* The Single UNIX Specification doesn't say that "mkstemp()" creates the temporary file with mode rw-------, so we diff --git a/text2pcap.c b/text2pcap.c index e8d1252f20..c0d557f346 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 */ - strcpy(&packet_preamble[packet_preamble_len], str); + strncpy(&packet_preamble[packet_preamble_len], str, PACKET_PREAMBLE_MAX_LEN - packet_preamble_len); packet_preamble_len += toklen; if (debug >= 2) { char *c; char xs[PACKET_PREAMBLE_MAX_LEN]; - strcpy(xs, packet_preamble); + strncpy(xs, packet_preamble, PACKET_PREAMBLE_MAX_LEN); while ((c = strchr(xs, '\r')) != NULL) *c=' '; fprintf (stderr, "[[append_to_preamble: \"%s\"]]", xs); } @@ -449,12 +449,11 @@ add_decode_as(const gchar *cl_param) ftenum_t dissector_table_selector_type; struct protocol_name_search user_protocol_name; -/* The following code will allocate and copy the command-line options in a string pointed by decoded_param */ + /* The following code will allocate and copy the command-line options in a string pointed by decoded_param */ g_assert(cl_param); - decoded_param = g_malloc( sizeof(gchar) * (strlen(cl_param) + 1) ); /* Allocate enough space to have a working copy of the command-line parameter */ + decoded_param = g_strdup(cl_param); g_assert(decoded_param); - strcpy(decoded_param, cl_param); /* The lines below will parse this string (modifying it) to extract all @@ -75,14 +75,14 @@ get_args_as_string(int argc, char **argv, int optind) /* * Now construct the string. */ - strcpy(argstring, ""); + argstring[0] = '\0'; i = optind; for (;;) { - strcat(argstring, argv[i]); + strncat(argstring, argv[i], len - strlen(argstring)); i++; if (i == argc) break; - strcat(argstring, " "); + strncat(argstring, " ", len - strlen(argstring)); } return argstring; } diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c index 16e3550781..39c0eb8c0c 100644 --- a/wiretap/catapult_dct2000.c +++ b/wiretap/catapult_dct2000.c @@ -331,7 +331,7 @@ gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_, char timestamp_string[32]; gint64 *pkey = NULL; - sprintf(timestamp_string, "%d.%04d", seconds, useconds/100); + g_snprintf(timestamp_string, 32, "%d.%04d", seconds, useconds/100); /* All packets go to Catapult DCT2000 stub dissector */ wth->phdr.pkt_encap = WTAP_ENCAP_CATAPULT_DCT2000; @@ -470,7 +470,7 @@ catapult_dct2000_seek_read(wtap *wth, gint64 seek_off, int n; int stub_offset = 0; char timestamp_string[32]; - sprintf(timestamp_string, "%d.%04d", seconds, useconds/100); + g_snprintf(timestamp_string, 32, "%d.%04d", seconds, useconds/100); /* Make sure all packets go to catapult dct2000 dissector */ wth->phdr.pkt_encap = WTAP_ENCAP_CATAPULT_DCT2000; diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c index c36611ec3a..9686737732 100644 --- a/wiretap/network_instruments.c +++ b/wiretap/network_instruments.c @@ -490,7 +490,7 @@ gboolean network_instruments_dump_open(wtap_dumper *wdh, gboolean cant_seek, int time(&system_time); current_time = localtime(&system_time); memset(&comment, 0x00, sizeof(comment)); - sprintf(comment, "This capture was saved from Wireshark on %s", asctime(current_time)); + g_snprintf(comment, 64, "This capture was saved from Wireshark on %s", asctime(current_time)); /* create the file header */ if (fseek(wdh->fh, 0, SEEK_SET) == -1) { @@ -498,7 +498,7 @@ gboolean network_instruments_dump_open(wtap_dumper *wdh, gboolean cant_seek, int return FALSE; } memset(&file_header, 0x00, sizeof(capture_file_header)); - strcpy(file_header.observer_version, network_instruments_magic); + strncpy(file_header.observer_version, network_instruments_magic, 32); file_header.offset_to_first_packet = sizeof(capture_file_header) + sizeof(tlv_header) + strlen(comment); file_header.offset_to_first_packet = GUINT16_TO_LE(file_header.offset_to_first_packet); file_header.number_of_information_elements = 1; diff --git a/wiretap/visual.c b/wiretap/visual.c index b2bfd19b0a..e4b449f6e9 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -886,7 +886,7 @@ static gboolean visual_dump_close(wtap_dumper *wdh, int *err) vfile_hdr.max_length = htoles(65535); vfile_hdr.file_flags = htoles(1); /* indexes are present */ vfile_hdr.file_version = htoles(1); - strcpy(vfile_hdr.description, "Wireshark file"); + strncpy(vfile_hdr.description, "Wireshark file", 64); /* Translate the encapsulation type */ switch (wdh->encap) diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 2ddb55bbfc..4544b33272 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -495,14 +495,14 @@ const char #ifdef HAVE_LIBZ if (err >= WTAP_ERR_ZLIB_MIN && err <= WTAP_ERR_ZLIB_MAX) { /* Assume it's a zlib error. */ - sprintf(errbuf, "Uncompression error: %s", + g_snprintf(errbuf, 128, "Uncompression error: %s", zError(err - WTAP_ERR_ZLIB)); return errbuf; } #endif wtap_errlist_index = -1 - err; if (wtap_errlist_index >= WTAP_ERRLIST_SIZE) { - sprintf(errbuf, "Error %d", err); + g_snprintf(errbuf, 128, "Error %d", err); return errbuf; } if (wtap_errlist[wtap_errlist_index] == NULL) |