aboutsummaryrefslogtreecommitdiffstats
path: root/capture_info.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2011-03-22 11:25:12 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2011-03-22 11:25:12 +0000
commit75568093eb64954083c8c7e459819a5c2083f536 (patch)
treefa3b73d0dd0796a78bd2f88dd934c9898674208a /capture_info.c
parenta07fff3b15fd01eadbe8d2e62bc23766cd9552cf (diff)
Rewrote error reporting to avoid using a 2048 bytes stack buffer.
Coverity 726. svn path=/trunk/; revision=36245
Diffstat (limited to 'capture_info.c')
-rw-r--r--capture_info.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/capture_info.c b/capture_info.c
index 49849ea0c2..54f01a4a3e 100644
--- a/capture_info.c
+++ b/capture_info.c
@@ -203,7 +203,7 @@ gboolean capture_info_new_file(const char *new_filename)
{
int err;
gchar *err_info;
- char err_msg[2048+1];
+ gchar *err_msg;
if(info_data.wtap != NULL) {
@@ -212,10 +212,10 @@ gboolean capture_info_new_file(const char *new_filename)
info_data.wtap = wtap_open_offline(new_filename, &err, &err_info, FALSE);
if (!info_data.wtap) {
- g_snprintf(err_msg, sizeof err_msg,
- cf_open_error_message(err, err_info, FALSE, WTAP_FILE_PCAP),
- new_filename);
+ err_msg = g_strdup_printf(cf_open_error_message(err, err_info, FALSE, WTAP_FILE_PCAP),
+ new_filename);
g_warning("capture_info_new_file: %d (%s)", err, err_msg);
+ g_free (err_msg);
return FALSE;
} else
return TRUE;