diff options
author | João Valverde <j@v6e.pt> | 2021-12-18 18:48:20 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2021-12-19 21:21:58 +0000 |
commit | 0ccd69e530ed18ac19a4484c76bdbef94d1ab2b1 (patch) | |
tree | ffb5f202b47fbead8ff87e573afd72c856c91ae0 /wiretap | |
parent | f984def50cfb20c5a47f7ac41b7b72bd270f2bb7 (diff) |
Replace g_strdup_printf() with ws_strdup_printf()
Use macros from inttypes.h.
Diffstat (limited to 'wiretap')
53 files changed, 342 insertions, 345 deletions
diff --git a/wiretap/5views.c b/wiretap/5views.c index 0c525c8c51..42881c9146 100644 --- a/wiretap/5views.c +++ b/wiretap/5views.c @@ -128,7 +128,7 @@ _5views_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("5views: header version %u unsupported", Capture_Header.Info_Header.Version); + *err_info = ws_strdup_printf("5views: header version %u unsupported", Capture_Header.Info_Header.Version); return WTAP_OPEN_ERROR; } @@ -138,7 +138,7 @@ _5views_open(wtap *wth, int *err, gchar **err_info) if((Capture_Header.Info_Header.FileType & CST_5VW_CAPTURE_FILE_TYPE_MASK) != CST_5VW_CAPTURE_FILEID) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("5views: file is not a capture file (filetype is %u)", Capture_Header.Info_Header.Version); + *err_info = ws_strdup_printf("5views: file is not a capture file (filetype is %u)", Capture_Header.Info_Header.Version); return WTAP_OPEN_ERROR; } @@ -152,7 +152,7 @@ _5views_open(wtap *wth, int *err, gchar **err_info) */ default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("5views: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("5views: network type %u unknown or unsupported", Capture_Header.Info_Header.FileType); return WTAP_OPEN_ERROR; } @@ -221,7 +221,7 @@ _5views_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("5views: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("5views: File has %u-byte packet, bigger than maximum of %u", rec->rec_header.packet_header.caplen, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -270,7 +270,7 @@ _5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr, hdr->Key = pletoh32(&hdr->Key); if (hdr->Key != CST_5VW_RECORDS_HEADER_KEY) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("5views: Time-stamped header has bad key value 0x%08X", + *err_info = ws_strdup_printf("5views: Time-stamped header has bad key value 0x%08X", hdr->Key); return FALSE; } diff --git a/wiretap/aethra.c b/wiretap/aethra.c index c693680107..58e815bb33 100644 --- a/wiretap/aethra.c +++ b/wiretap/aethra.c @@ -309,7 +309,7 @@ aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr, if (rec_size < (sizeof *hdr - sizeof hdr->rec_size)) { /* The record is shorter than a record header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("aethra: File has %u-byte record, less than minimum of %u", + *err_info = ws_strdup_printf("aethra: File has %u-byte record, less than minimum of %u", rec_size, (unsigned int)(sizeof *hdr - sizeof hdr->rec_size)); return FALSE; @@ -321,7 +321,7 @@ aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr, * space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("aethra: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("aethra: File has %u-byte packet, bigger than maximum of %u", rec_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/blf.c b/wiretap/blf.c index c7c054bc6c..6947176572 100644 --- a/wiretap/blf.c +++ b/wiretap/blf.c @@ -542,7 +542,7 @@ blf_read_bytes_or_eof(blf_params_t *params, guint64 real_pos, void *target_buffe * malformed file (WTAP_ERR_BAD_FILE)? */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("blf_read_bytes_or_eof: cannot refresh container"); + *err_info = ws_strdup_printf("blf_read_bytes_or_eof: cannot refresh container"); ws_debug("cannot refresh container"); return FALSE; } @@ -580,7 +580,7 @@ blf_read_bytes_or_eof(blf_params_t *params, guint64 real_pos, void *target_buffe * malformed file (WTAP_ERR_BAD_FILE)? */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("blf_read_bytes_or_eof: cannot pull in container"); + *err_info = ws_strdup_printf("blf_read_bytes_or_eof: cannot pull in container"); ws_debug("cannot pull in container"); return FALSE; } @@ -591,7 +591,7 @@ blf_read_bytes_or_eof(blf_params_t *params, guint64 real_pos, void *target_buffe * malformed file (WTAP_ERR_BAD_FILE)? */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("blf_read_bytes_or_eof: cannot refresh container"); + *err_info = ws_strdup_printf("blf_read_bytes_or_eof: cannot refresh container"); ws_debug("cannot refresh container"); return FALSE; } @@ -602,7 +602,7 @@ blf_read_bytes_or_eof(blf_params_t *params, guint64 real_pos, void *target_buffe * malformed file (WTAP_ERR_BAD_FILE)? */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("blf_read_bytes_or_eof: pulling in container failed hard"); + *err_info = ws_strdup_printf("blf_read_bytes_or_eof: pulling in container failed hard"); ws_debug("pulling in container failed hard"); return FALSE; } @@ -624,13 +624,13 @@ blf_read_bytes_or_eof(blf_params_t *params, guint64 real_pos, void *target_buffe * malformed file (WTAP_ERR_BAD_FILE)? */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("blf_read_bytes_or_eof: ran out of items in container"); + *err_info = ws_strdup_printf("blf_read_bytes_or_eof: ran out of items in container"); return FALSE; break; default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("blf: unknown compression method %u", + *err_info = ws_strdup_printf("blf: unknown compression method %u", start_container->compression_method); ws_debug("unknown compression method"); return FALSE; @@ -794,7 +794,7 @@ static gboolean blf_read_log_object_header(blf_params_t *params, int *err, gchar **err_info, gint64 header2_start, gint64 data_start, blf_logobjectheader_t *logheader) { if (data_start - header2_start < (gint64)sizeof(blf_logobjectheader_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: not enough bytes for log object header"); + *err_info = ws_strdup_printf("blf: not enough bytes for log object header"); ws_debug("not enough bytes for timestamp header"); return FALSE; } @@ -820,7 +820,7 @@ blf_read_ethernetframe(blf_params_t *params, int *err, gchar **err_info, gint64 if (object_length < (data_start - block_start) + (int) sizeof(blf_ethernetframeheader_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: ETHERNET_FRAME: not enough bytes for ethernet frame header in object"); + *err_info = ws_strdup_printf("blf: ETHERNET_FRAME: not enough bytes for ethernet frame header in object"); ws_debug("not enough bytes for ethernet frame header in object"); return FALSE; } @@ -894,7 +894,7 @@ blf_read_ethernetframe_ext(blf_params_t *params, int *err, gchar **err_info, gin if (object_length < (data_start - block_start) + (int) sizeof(blf_ethernetframeheader_ex_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: ETHERNET_FRAME_EX: not enough bytes for ethernet frame header in object"); + *err_info = ws_strdup_printf("blf: ETHERNET_FRAME_EX: not enough bytes for ethernet frame header in object"); ws_debug("not enough bytes for ethernet frame header in object"); return FALSE; } @@ -909,7 +909,7 @@ blf_read_ethernetframe_ext(blf_params_t *params, int *err, gchar **err_info, gin if (object_length - (data_start - block_start) - sizeof(blf_ethernetframeheader_ex_t) < ethheader.frame_length) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: ETHERNET_FRAME_EX: frame too short"); + *err_info = ws_strdup_printf("blf: ETHERNET_FRAME_EX: frame too short"); ws_debug("frame too short"); return FALSE; } @@ -937,7 +937,7 @@ blf_read_wlanframe(blf_params_t* params, int* err, gchar** err_info, gint64 bloc if (object_length < (data_start - block_start) + (int)sizeof(blf_wlanframeheader_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: WLAN_FRAME: not enough bytes for wlan frame header in object"); + *err_info = ws_strdup_printf("blf: WLAN_FRAME: not enough bytes for wlan frame header in object"); ws_debug("not enough bytes for wlan frame header in object"); return FALSE; } @@ -952,7 +952,7 @@ blf_read_wlanframe(blf_params_t* params, int* err, gchar** err_info, gint64 bloc if (object_length - (data_start - block_start) - sizeof(blf_wlanframeheader_t) < wlanheader.frame_length) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: WLAN_FRAME: frame too short"); + *err_info = ws_strdup_printf("blf: WLAN_FRAME: frame too short"); ws_debug("frame too short"); return FALSE; } @@ -1018,7 +1018,7 @@ blf_read_canmessage(blf_params_t *params, int *err, gchar **err_info, gint64 blo if (object_length < (data_start - block_start) + (int) sizeof(canheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: %s: not enough bytes for canfd header in object", + *err_info = ws_strdup_printf("blf: %s: not enough bytes for canfd header in object", can_message2 ? "CAN_MESSAGE2" : "CAN_MESSAGE"); ws_debug("not enough bytes for canfd header in object"); return FALSE; @@ -1062,7 +1062,7 @@ blf_read_canmessage(blf_params_t *params, int *err, gchar **err_info, gint64 blo if (can_message2) { if (object_length < (data_start - block_start) + (int) sizeof(canheader) + payload_length_valid + (int) sizeof(can2trailer)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: CAN_MESSAGE2: not enough bytes for can message 2 trailer"); + *err_info = ws_strdup_printf("blf: CAN_MESSAGE2: not enough bytes for can message 2 trailer"); ws_debug("not enough bytes for can message 2 trailer"); return FALSE; } @@ -1094,7 +1094,7 @@ blf_read_canfdmessage(blf_params_t *params, int *err, gchar **err_info, gint64 b if (object_length < (data_start - block_start) + (int) sizeof(canheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: CAN_FD_MESSAGE: not enough bytes for canfd header in object"); + *err_info = ws_strdup_printf("blf: CAN_FD_MESSAGE: not enough bytes for canfd header in object"); ws_debug("not enough bytes for canfd header in object"); return FALSE; } @@ -1163,7 +1163,7 @@ blf_read_canfdmessage64(blf_params_t *params, int *err, gchar **err_info, gint64 if (object_length < (data_start - block_start) + (int) sizeof(canheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: CAN_FD_MESSAGE_64: not enough bytes for canfd header in object"); + *err_info = ws_strdup_printf("blf: CAN_FD_MESSAGE_64: not enough bytes for canfd header in object"); ws_debug("not enough bytes for canfd header in object"); return FALSE; } @@ -1240,7 +1240,7 @@ blf_read_flexraydata(blf_params_t *params, int *err, gchar **err_info, gint64 bl if (object_length < (data_start - block_start) + (int) sizeof(frheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: FLEXRAY_DATA: not enough bytes for flexrayheader in object"); + *err_info = ws_strdup_printf("blf: FLEXRAY_DATA: not enough bytes for flexrayheader in object"); ws_debug("not enough bytes for flexrayheader in object"); return FALSE; } @@ -1317,7 +1317,7 @@ blf_read_flexraymessage(blf_params_t *params, int *err, gchar **err_info, gint64 if (object_length < (data_start - block_start) + (int) sizeof(frheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: FLEXRAY_MESSAGE: not enough bytes for flexrayheader in object"); + *err_info = ws_strdup_printf("blf: FLEXRAY_MESSAGE: not enough bytes for flexrayheader in object"); ws_debug("not enough bytes for flexrayheader in object"); return FALSE; } @@ -1416,7 +1416,7 @@ blf_read_flexrayrcvmessageex(blf_params_t *params, int *err, gchar **err_info, g if ((gint64)object_length < (data_start - block_start) + frheadersize) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: %s: not enough bytes for flexrayheader in object", + *err_info = ws_strdup_printf("blf: %s: not enough bytes for flexrayheader in object", ext ? "FLEXRAY_RCVMESSAGE_EX" : "FLEXRAY_RCVMESSAGE"); ws_debug("not enough bytes for flexrayheader in object"); return FALSE; @@ -1513,7 +1513,7 @@ blf_read_linmessage(blf_params_t *params, int *err, gchar **err_info, gint64 blo if (object_length < (data_start - block_start) + (int)sizeof(linheader)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: LIN_MESSAGE: not enough bytes for linmessage header in object"); + *err_info = ws_strdup_printf("blf: LIN_MESSAGE: not enough bytes for linmessage header in object"); ws_debug("not enough bytes for linmessage header in object"); return FALSE; } @@ -1559,7 +1559,7 @@ blf_read_linmessage(blf_params_t *params, int *err, gchar **err_info, gint64 blo if (object_length < (data_start - block_start) + (int)sizeof(linheader) + payload_length_valid + (int)sizeof(lintrailer)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("blf: LIN_MESSAGE: not enough bytes for linmessage trailer"); + *err_info = ws_strdup_printf("blf: LIN_MESSAGE: not enough bytes for linmessage trailer"); ws_debug("not enough bytes for linmessage trailer"); return FALSE; } @@ -1613,7 +1613,7 @@ blf_read_block(blf_params_t *params, gint64 start_pos, int *err, gchar **err_inf if (header.header_type != BLF_HEADER_TYPE_DEFAULT) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("blf: unknown header type %u", + *err_info = ws_strdup_printf("blf: unknown header type %u", header.header_type); ws_debug("unknown header type"); return FALSE; @@ -1625,7 +1625,7 @@ blf_read_block(blf_params_t *params, gint64 start_pos, int *err, gchar **err_inf switch (header.object_type) { case BLF_OBJTYPE_LOG_CONTAINER: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("blf: log container in log container not supported"); + *err_info = ws_strdup_printf("blf: log container in log container not supported"); ws_debug("log container in log container not supported"); return FALSE; break; diff --git a/wiretap/btsnoop.c b/wiretap/btsnoop.c index 36904ac86f..806862837a 100644 --- a/wiretap/btsnoop.c +++ b/wiretap/btsnoop.c @@ -103,7 +103,7 @@ wtap_open_return_val btsnoop_open(wtap *wth, int *err, gchar **err_info) hdr.version = g_ntohl(hdr.version); if (hdr.version != 1) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("btsnoop: version %u unsupported", hdr.version); + *err_info = ws_strdup_printf("btsnoop: version %u unsupported", hdr.version); return WTAP_OPEN_ERROR; } @@ -132,7 +132,7 @@ wtap_open_return_val btsnoop_open(wtap *wth, int *err, gchar **err_info) return WTAP_OPEN_ERROR; default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("btsnoop: datalink type %u unknown or unsupported", hdr.datalink); + *err_info = ws_strdup_printf("btsnoop: datalink type %u unknown or unsupported", hdr.datalink); return WTAP_OPEN_ERROR; } @@ -194,7 +194,7 @@ static gboolean btsnoop_read_record(wtap *wth, FILE_T fh, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("btsnoop: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("btsnoop: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -302,7 +302,7 @@ static gboolean btsnoop_dump(wtap_dumper *wdh, case BTHCI_CHANNEL_COMMAND: if (!pseudo_header->bthci.sent) { *err = WTAP_ERR_UNWRITABLE_REC_DATA; - *err_info = g_strdup_printf("btsnoop: Command channel, sent FALSE"); + *err_info = ws_strdup_printf("btsnoop: Command channel, sent FALSE"); return FALSE; } flags = KHciLoggerCommandOrEvent|KHciLoggerHostToController; @@ -311,7 +311,7 @@ static gboolean btsnoop_dump(wtap_dumper *wdh, case BTHCI_CHANNEL_EVENT: if (pseudo_header->bthci.sent) { *err = WTAP_ERR_UNWRITABLE_REC_DATA; - *err_info = g_strdup_printf("btsnoop: Event channel, sent TRUE"); + *err_info = ws_strdup_printf("btsnoop: Event channel, sent TRUE"); return FALSE; } flags = KHciLoggerCommandOrEvent|KHciLoggerControllerToHost; @@ -326,7 +326,7 @@ static gboolean btsnoop_dump(wtap_dumper *wdh, default: *err = WTAP_ERR_UNWRITABLE_REC_DATA; - *err_info = g_strdup_printf("btsnoop: Unknown channel %u", + *err_info = ws_strdup_printf("btsnoop: Unknown channel %u", pseudo_header->bthci.channel); return FALSE; } @@ -350,7 +350,7 @@ static gboolean btsnoop_dump(wtap_dumper *wdh, /* We should never get here - our open routine should only get called for the types above. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("btsnoop: invalid encapsulation %u", + *err_info = ws_strdup_printf("btsnoop: invalid encapsulation %u", wdh->encap); return FALSE; } @@ -403,7 +403,7 @@ static gboolean btsnoop_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _ /* We should never get here - our open routine should only get called for the types above. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("btsnoop: invalid encapsulation %u", + *err_info = ws_strdup_printf("btsnoop: invalid encapsulation %u", wdh->encap); return FALSE; } diff --git a/wiretap/busmaster_parser.lemon b/wiretap/busmaster_parser.lemon index 59b79cd4d4..3e346bfb7a 100644 --- a/wiretap/busmaster_parser.lemon +++ b/wiretap/busmaster_parser.lemon @@ -71,7 +71,7 @@ DIAG_OFF(unreachable-code) g_free(state->parse_error); state->entry_type = LOG_ENTRY_ERROR; - state->parse_error = g_strdup_printf("Syntax Error"); + state->parse_error = ws_strdup_printf("Syntax Error"); busmaster_debug_printf("%s: Syntax Error\n", G_STRFUNC); } diff --git a/wiretap/camins.c b/wiretap/camins.c index f26b5910a5..2a825c6e33 100644 --- a/wiretap/camins.c +++ b/wiretap/camins.c @@ -336,7 +336,7 @@ create_pseudo_hdr(guint8 *buf, guint8 dat_trans_type, guint16 dat_len, else if (dat_trans_type==TRANS_HOST_CAM) buf[1] = DVB_CI_PSEUDO_HDR_HOST_TO_CAM; else { - *err_info = g_strdup_printf("camins: invalid dat_trans_type %u", dat_trans_type); + *err_info = ws_strdup_printf("camins: invalid dat_trans_type %u", dat_trans_type); return -1; } diff --git a/wiretap/candump_parser.lemon b/wiretap/candump_parser.lemon index a8e501424f..3fd659cc05 100644 --- a/wiretap/candump_parser.lemon +++ b/wiretap/candump_parser.lemon @@ -70,7 +70,7 @@ DIAG_OFF(unreachable-code) #endif g_free(state->parse_error); - state->parse_error = g_strdup_printf("Syntax Error"); + state->parse_error = ws_strdup_printf("Syntax Error"); #ifdef CANDUMP_DEBUG candump_debug_printf("%s: Syntax Error\n", G_STRFUNC); #endif diff --git a/wiretap/capsa.c b/wiretap/capsa.c index b8bf256d29..786137fe28 100644 --- a/wiretap/capsa.c +++ b/wiretap/capsa.c @@ -159,7 +159,7 @@ wtap_open_return_val capsa_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("capsa: format indicator %u unsupported", + *err_info = ws_strdup_printf("capsa: format indicator %u unsupported", format_indicator); return WTAP_OPEN_ERROR; } @@ -371,7 +371,7 @@ capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, default: ws_assert_not_reached(); *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("capsa: format indicator is %u", capsa->format_indicator); + *err_info = ws_strdup_printf("capsa: format indicator is %u", capsa->format_indicator); return -1; } if (orig_size > WTAP_MAX_PACKET_SIZE_STANDARD) { @@ -380,7 +380,7 @@ capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("capsa: File has %u-byte original length, bigger than maximum of %u", + *err_info = ws_strdup_printf("capsa: File has %u-byte original length, bigger than maximum of %u", orig_size, WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -390,7 +390,7 @@ capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("capsa: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("capsa: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -399,7 +399,7 @@ capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * Probably a corrupt capture file. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("capsa: File has %u-byte packet with %u-byte record header, bigger than record size %u", + *err_info = ws_strdup_printf("capsa: File has %u-byte packet with %u-byte record header, bigger than record size %u", packet_size, header_size, rec_size); return -1; } diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c index bd4af92ac2..9d4a5a0f69 100644 --- a/wiretap/catapult_dct2000.c +++ b/wiretap/catapult_dct2000.c @@ -504,7 +504,7 @@ catapult_dct2000_seek_read(wtap *wth, gint64 seek_off, /* If get here, must have failed */ *err = errno; - *err_info = g_strdup_printf("catapult dct2000: seek_read failed to read/parse " + *err_info = ws_strdup_printf("catapult dct2000: seek_read failed to read/parse " "line at position %" PRId64, seek_off); return FALSE; @@ -1312,7 +1312,7 @@ process_parsed_line(wtap *wth, dct2000_file_externals_t *file_externals, * space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("catapult dct2000: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("catapult dct2000: File has %u-byte packet, bigger than maximum of %u", rec->rec_header.packet_header.caplen, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/commview.c b/wiretap/commview.c index a30e613c57..6f4ebbad71 100644 --- a/wiretap/commview.c +++ b/wiretap/commview.c @@ -302,7 +302,7 @@ commview_ncf_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, default : *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: unsupported encap for NCF: %u", + *err_info = ws_strdup_printf("commview: unsupported encap for NCF: %u", cv_hdr.flags & FLAGS_MEDIUM); return FALSE; } @@ -803,7 +803,7 @@ commview_ncfx_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, */ if (length_remaining < COMMVIEW_NCFX_RF_HEADER_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: RF header goes past the NCFX data length %u", + *err_info = ws_strdup_printf("commview: RF header goes past the NCFX data length %u", cv_hdr.data_len); return FALSE; } @@ -908,7 +908,7 @@ commview_ncfx_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, */ if (length_remaining < COMMVIEW_NCFX_MCS_HEADER_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: MCS header goes past the NCFX data length %u", + *err_info = ws_strdup_printf("commview: MCS header goes past the NCFX data length %u", cv_hdr.data_len); return FALSE; } @@ -990,7 +990,7 @@ commview_ncfx_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, default : *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: unsupported encap for NCFX: %u", + *err_info = ws_strdup_printf("commview: unsupported encap for NCFX: %u", cv_hdr.medium_type); return FALSE; } @@ -1013,7 +1013,7 @@ commview_ncfx_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("commview: File has %u-byte packet, bigger than maximum of %u", length_remaining, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -1059,7 +1059,7 @@ commview_ncfx_read_header(commview_ncfx_header_t *cv_hdr, FILE_T fh, int *err, /* It must be at least the length of the general header. */ if (cv_hdr->data_len < COMMVIEW_NCFX_HEADER_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("commview: NCFX data length %u < %u", + *err_info = ws_strdup_printf("commview: NCFX data length %u < %u", cv_hdr->data_len, COMMVIEW_NCFX_HEADER_SIZE); return FALSE; diff --git a/wiretap/cosine.c b/wiretap/cosine.c index b9b1f615ab..d7afb03980 100644 --- a/wiretap/cosine.c +++ b/wiretap/cosine.c @@ -377,7 +377,7 @@ parse_cosine_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("cosine: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("cosine: File has %u-byte packet, bigger than maximum of %u", (guint)pkt_len, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/daintree-sna.c b/wiretap/daintree-sna.c index aa8fd7a6cd..08e2bb3234 100644 --- a/wiretap/daintree-sna.c +++ b/wiretap/daintree-sna.c @@ -184,7 +184,7 @@ daintree_sna_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, /* Daintree doesn't store the FCS, but pads end of packet with 0xffff, which we toss */ if (rec->rec_header.packet_header.len <= FCS_LENGTH) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("daintree_sna: packet length <= %u bytes, no frame data present", + *err_info = ws_strdup_printf("daintree_sna: packet length <= %u bytes, no frame data present", FCS_LENGTH); return FALSE; } @@ -236,14 +236,14 @@ daintree_sna_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, /* Daintree doesn't store the FCS, but pads end of packet with 0xffff, which we toss */ if (bytes <= FCS_LENGTH) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("daintree_sna: Only %u bytes of packet data", + *err_info = ws_strdup_printf("daintree_sna: Only %u bytes of packet data", bytes); return FALSE; } bytes -= FCS_LENGTH; if (bytes > rec->rec_header.packet_header.len) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("daintree_sna: capture length (%u) > packet length (%u)", + *err_info = ws_strdup_printf("daintree_sna: capture length (%u) > packet length (%u)", bytes, rec->rec_header.packet_header.len); return FALSE; } diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c index 83ab8647cd..d620674486 100644 --- a/wiretap/dbs-etherwatch.c +++ b/wiretap/dbs-etherwatch.c @@ -456,7 +456,7 @@ parse_dbs_etherwatch_packet(FILE_T fh, wtap_rec *rec, Buffer* buf, * space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dbs_etherwatch: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("dbs_etherwatch: File has %u-byte packet, bigger than maximum of %u", rec->rec_header.packet_header.caplen, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/dct3trace.c b/wiretap/dct3trace.c index f361ca4b9c..1476247d6b 100644 --- a/wiretap/dct3trace.c +++ b/wiretap/dct3trace.c @@ -131,7 +131,7 @@ xml_get_int(int *val, const char *str, const char *pattern, int *err, gchar **er ptr = strstr(str, pattern); if (ptr == NULL) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: %s not found", pattern); + *err_info = ws_strdup_printf("dct3trace: %s not found", pattern); return FALSE; } /* @@ -140,7 +140,7 @@ xml_get_int(int *val, const char *str, const char *pattern, int *err, gchar **er start = strchr(ptr, '"'); if (start == NULL) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: opening quote for %s not found", pattern); + *err_info = ws_strdup_printf("dct3trace: opening quote for %s not found", pattern); return FALSE; } start++; @@ -151,12 +151,12 @@ xml_get_int(int *val, const char *str, const char *pattern, int *err, gchar **er end = strchr(start, '"'); if (end == NULL) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: closing quote for %s not found", pattern); + *err_info = ws_strdup_printf("dct3trace: closing quote for %s not found", pattern); return FALSE; } if (end - start > 31) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: %s value is too long", pattern); + *err_info = ws_strdup_printf("dct3trace: %s value is too long", pattern); return FALSE; } @@ -170,16 +170,16 @@ xml_get_int(int *val, const char *str, const char *pattern, int *err, gchar **er *err = WTAP_ERR_BAD_FILE; if (errno == ERANGE) { if (*val < 0) - *err_info = g_strdup_printf("dct3trace: %s value is too small, minimum is %d", pattern, *val); + *err_info = ws_strdup_printf("dct3trace: %s value is too small, minimum is %d", pattern, *val); else - *err_info = g_strdup_printf("dct3trace: %s value is too large, maximum is %d", pattern, *val); + *err_info = ws_strdup_printf("dct3trace: %s value is too large, maximum is %d", pattern, *val); } else - *err_info = g_strdup_printf("dct3trace: %s value \"%s\" not a number", pattern, buf); + *err_info = ws_strdup_printf("dct3trace: %s value \"%s\" not a number", pattern, buf); return FALSE; } if (*endptr != '\0') { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: %s value \"%s\" not a number", pattern, buf); + *err_info = ws_strdup_printf("dct3trace: %s value \"%s\" not a number", pattern, buf); return FALSE; } return TRUE; @@ -322,7 +322,7 @@ static gboolean dct3trace_get_packet(FILE_T fh, wtap_rec *rec, if (len == -1) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: record length %d too long", rec->rec_header.packet_header.caplen); + *err_info = ws_strdup_printf("dct3trace: record length %d too long", rec->rec_header.packet_header.caplen); return FALSE; } } @@ -362,7 +362,7 @@ static gboolean dct3trace_get_packet(FILE_T fh, wtap_rec *rec, if (data_len == -1) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dct3trace: record length %d too long", rec->rec_header.packet_header.caplen); + *err_info = ws_strdup_printf("dct3trace: record length %d too long", rec->rec_header.packet_header.caplen); return FALSE; } len += data_len; diff --git a/wiretap/dpa400.c b/wiretap/dpa400.c index d348d4b691..671dbdfffd 100644 --- a/wiretap/dpa400.c +++ b/wiretap/dpa400.c @@ -164,7 +164,7 @@ static gboolean dpa400_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, if (++ctr > WTAP_MAX_PACKET_SIZE_STANDARD) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dpa400: File has data record bigger than maximum of %u", + *err_info = ws_strdup_printf("dpa400: File has data record bigger than maximum of %u", WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -193,7 +193,7 @@ static gboolean dpa400_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, default: *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("dpa400: unknown packet type %02x", chunk[0]); + *err_info = ws_strdup_printf("dpa400: unknown packet type %02x", chunk[0]); return FALSE; } diff --git a/wiretap/erf.c b/wiretap/erf.c index a9903b45e2..004f0a4c67 100644 --- a/wiretap/erf.c +++ b/wiretap/erf.c @@ -696,7 +696,7 @@ static gboolean erf_read_header(wtap *wth, FILE_T fh, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u", *packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -892,7 +892,7 @@ static gboolean erf_read_header(wtap *wth, FILE_T fh, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u", *packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -2435,22 +2435,22 @@ static int erf_populate_interface(erf_t *erf_priv, wtap *wth, union wtap_pseudo_ if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: erf_populate_interface called with wth NULL"); + *err_info = ws_strdup_printf("erf: erf_populate_interface called with wth NULL"); return -1; } if (!pseudo_header) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: erf_populate_interface called with pseudo_header NULL"); + *err_info = ws_strdup_printf("erf: erf_populate_interface called with pseudo_header NULL"); return -1; } if (!erf_priv) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: erf_populate_interface called with erf_priv NULL"); + *err_info = ws_strdup_printf("erf: erf_populate_interface called with erf_priv NULL"); return -1; } if (if_num > 3) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: erf_populate_interface called with if_num %u > 3", + *err_info = ws_strdup_printf("erf: erf_populate_interface called with if_num %u > 3", if_num); return -1; } @@ -2559,22 +2559,22 @@ static int populate_capture_host_info(erf_t *erf_priv, wtap *wth, union wtap_pse if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_capture_host_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_capture_host_info called with wth NULL"); return -1; } if (!state) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_capture_host_info called with state NULL"); + *err_info = ws_strdup_printf("erf: populate_capture_host_info called with state NULL"); return -1; } if (!wth->shb_hdrs) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_capture_host_info called with wth->shb_hdrs NULL"); + *err_info = ws_strdup_printf("erf: populate_capture_host_info called with wth->shb_hdrs NULL"); return -1; } if (wth->shb_hdrs->len == 0) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_capture_host_info called with wth->shb_hdrs->len 0"); + *err_info = ws_strdup_printf("erf: populate_capture_host_info called with wth->shb_hdrs->len 0"); return -1; } @@ -2725,12 +2725,12 @@ static int populate_module_info(erf_t *erf_priv _U_, wtap *wth, union wtap_pseud if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_module_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_module_info called with wth NULL"); return -1; } if (!state) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_module_info called with stat NULL"); + *err_info = ws_strdup_printf("erf: populate_module_info called with stat NULL"); return -1; } @@ -2779,22 +2779,22 @@ static int populate_interface_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_interface_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_interface_info called with wth NULL"); return -1; } if (!state) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_interface_info called with state NULL"); + *err_info = ws_strdup_printf("erf: populate_interface_info called with state NULL"); return -1; } if (!pseudo_header) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_interface_info called with pseudo_header NULL"); + *err_info = ws_strdup_printf("erf: populate_interface_info called with pseudo_header NULL"); return -1; } if (!state->if_map) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_interface_info called with state->if_map NULL"); + *err_info = ws_strdup_printf("erf: populate_interface_info called with state->if_map NULL"); return -1; } @@ -2856,7 +2856,7 @@ static int populate_interface_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo return 0; } else { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_interface_info got interface_index %d < 0 and != -2", interface_index); + *err_info = ws_strdup_printf("erf: populate_interface_info got interface_index %d < 0 and != -2", interface_index); return -1; } } @@ -2999,22 +2999,22 @@ static int populate_stream_info(erf_t *erf_priv _U_, wtap *wth, union wtap_pseud if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_stream_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_stream_info called with wth NULL"); return -1; } if (!pseudo_header) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_stream_info called with pseudo_header NULL"); + *err_info = ws_strdup_printf("erf: populate_stream_info called with pseudo_header NULL"); return -1; } if (!state) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_stream_info called with state NULL"); + *err_info = ws_strdup_printf("erf: populate_stream_info called with state NULL"); return -1; } if (!state->if_map) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_stream_info called with state->if_map NULL"); + *err_info = ws_strdup_printf("erf: populate_stream_info called with state->if_map NULL"); return -1; } @@ -3147,17 +3147,17 @@ static int populate_anchor_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo_he if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_anchor_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_anchor_info called with wth NULL"); return -1; } if (!state) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_anchor_info called with state NULL"); + *err_info = ws_strdup_printf("erf: populate_anchor_info called with state NULL"); return -1; } if (!pseudo_header) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_anchor_info called with pseudo_header NULL"); + *err_info = ws_strdup_printf("erf: populate_anchor_info called with pseudo_header NULL"); return -1; } @@ -3230,17 +3230,17 @@ static int populate_summary_info(erf_t *erf_priv, wtap *wth, union wtap_pseudo_h if (!wth) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_summary_info called with wth NULL"); + *err_info = ws_strdup_printf("erf: populate_summary_info called with wth NULL"); return -1; } if (!pseudo_header) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_summary_info called with pseudo_header NULL"); + *err_info = ws_strdup_printf("erf: populate_summary_info called with pseudo_header NULL"); return -1; } if (!erf_priv) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("erf: populate_summary_info called with erf_priv NULL"); + *err_info = ws_strdup_printf("erf: populate_summary_info called with erf_priv NULL"); return -1; } diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c index 3f2be31f7c..b7acc2cac6 100644 --- a/wiretap/eyesdn.c +++ b/wiretap/eyesdn.c @@ -237,7 +237,7 @@ read_eyesdn_rec(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, if(pkt_len != CELL_LEN) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "eyesdn: ATM cell has a length != 53 (%u)", pkt_len); return FALSE; @@ -293,7 +293,7 @@ read_eyesdn_rec(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, if(pkt_len > WTAP_MAX_PACKET_SIZE_STANDARD) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("eyesdn: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("eyesdn: File has %u-byte packet, bigger than maximum of %u", pkt_len, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 6d5ede5571..0839523ac7 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -112,7 +112,7 @@ add_extensions(GSList *extensions, const gchar *extension, compression_type_extension != NULL; compression_type_extension = g_slist_next(compression_type_extension)) { extensions = g_slist_prepend(extensions, - g_strdup_printf("%s.%s", extension, + ws_strdup_printf("%s.%s", extension, (const char *)compression_type_extension->data)); } diff --git a/wiretap/hcidump.c b/wiretap/hcidump.c index b11b91c9ac..2755a86c97 100644 --- a/wiretap/hcidump.c +++ b/wiretap/hcidump.c @@ -41,7 +41,7 @@ static gboolean hcidump_read_packet(FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("hcidump: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("hcidump: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c index 09251bd071..e38e1358a6 100644 --- a/wiretap/i4btrace.c +++ b/wiretap/i4btrace.c @@ -228,7 +228,7 @@ i4b_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, if (hdr.length < sizeof(hdr)) { *err = WTAP_ERR_BAD_FILE; /* record length < header! */ - *err_info = g_strdup_printf("i4btrace: record length %u < header length %lu", + *err_info = ws_strdup_printf("i4btrace: record length %u < header length %lu", hdr.length, (unsigned long)sizeof(hdr)); return FALSE; } @@ -239,7 +239,7 @@ i4b_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("i4btrace: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("i4btrace: File has %u-byte packet, bigger than maximum of %u", length, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/ipfix.c b/wiretap/ipfix.c index 32e4ffec2e..b9ed377c4d 100644 --- a/wiretap/ipfix.c +++ b/wiretap/ipfix.c @@ -116,13 +116,13 @@ ipfix_read_message_header(ipfix_message_header_t *pfx_hdr, FILE_T fh, int *err, if (pfx_hdr->version != IPFIX_VERSION) { /* Not an ipfix file. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("ipfix: wrong version %d", pfx_hdr->version); + *err_info = ws_strdup_printf("ipfix: wrong version %d", pfx_hdr->version); return FALSE; } if (pfx_hdr->message_length < 16) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("ipfix: message length %u is too short", pfx_hdr->message_length); + *err_info = ws_strdup_printf("ipfix: message length %u is too short", pfx_hdr->message_length); return FALSE; } diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c index bd84ea040a..f9ae4b8d70 100644 --- a/wiretap/iptrace.c +++ b/wiretap/iptrace.c @@ -218,7 +218,7 @@ iptrace_read_rec_1_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * packet information header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet information header", + *err_info = ws_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet information header", record_length); return FALSE; } @@ -241,7 +241,7 @@ iptrace_read_rec_1_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, rec->rec_header.packet_header.pkt_encap = wtap_encap_ift(info.if_type); if (rec->rec_header.packet_header.pkt_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("iptrace: interface type IFT=0x%02x unknown or unsupported", + *err_info = ws_strdup_printf("iptrace: interface type IFT=0x%02x unknown or unsupported", info.if_type); return FALSE; } @@ -264,7 +264,7 @@ iptrace_read_rec_1_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * the padding. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header", + *err_info = ws_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header", record_length); return FALSE; } @@ -282,7 +282,7 @@ iptrace_read_rec_1_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("iptrace: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -472,7 +472,7 @@ iptrace_read_rec_2_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * packet information header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet information header", + *err_info = ws_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet information header", record_length); return FALSE; } @@ -512,7 +512,7 @@ iptrace_read_rec_2_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, */ if (rec->rec_header.packet_header.pkt_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("iptrace: interface type IFT=0x%02x unknown or unsupported", + *err_info = ws_strdup_printf("iptrace: interface type IFT=0x%02x unknown or unsupported", info.if_type); return FALSE; } @@ -536,7 +536,7 @@ iptrace_read_rec_2_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * the padding. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header", + *err_info = ws_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header", record_length); return FALSE; } @@ -554,7 +554,7 @@ iptrace_read_rec_2_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iptrace: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("iptrace: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/iseries.c b/wiretap/iseries.c index eb43142802..f8be5025ab 100644 --- a/wiretap/iseries.c +++ b/wiretap/iseries.c @@ -483,7 +483,7 @@ iseries_seek_next_packet (wtap * wth, int *err, gchar **err_info) *err = WTAP_ERR_BAD_FILE; *err_info = - g_strdup_printf ("iseries: next packet header not found within %d lines", + ws_strdup_printf ("iseries: next packet header not found within %d lines", ISERIES_MAX_TRACE_LEN); return -1; } @@ -747,7 +747,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, wtap_rec *rec, * the error message, to avoid an overflow.) */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("iseries: File has %" PRIu64 "-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("iseries: File has %" PRIu64 "-byte packet, bigger than maximum of %u", (guint64)pkt_len + 14, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; diff --git a/wiretap/k12.c b/wiretap/k12.c index e5e145cd5a..de4c48149d 100644 --- a/wiretap/k12.c +++ b/wiretap/k12.c @@ -484,12 +484,12 @@ static gint get_record(k12_t *file_data, FILE_T fh, gint64 file_offset, */ if (left < 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: Record length %u is less than 8 bytes long",left); + *err_info = ws_strdup_printf("k12: Record length %u is less than 8 bytes long",left); return -1; } if (left > WTAP_MAX_PACKET_SIZE_STANDARD) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: Record length %u is greater than the maximum %u",left,WTAP_MAX_PACKET_SIZE_STANDARD); + *err_info = ws_strdup_printf("k12: Record length %u is greater than the maximum %u",left,WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -582,7 +582,7 @@ process_packet_data(wtap_rec *rec, Buffer *target, guint8 *buffer, buffer_offset = (type == K12_REC_D0020) ? K12_PACKET_FRAME_D0020 : K12_PACKET_FRAME; if (buffer_offset > record_len) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: Frame data offset %u > record length %u", + *err_info = ws_strdup_printf("k12: Frame data offset %u > record length %u", buffer_offset, record_len); return FALSE; } @@ -590,7 +590,7 @@ process_packet_data(wtap_rec *rec, Buffer *target, guint8 *buffer, length = pntoh32(buffer + K12_RECORD_FRAME_LEN) & 0x00001FFF; if (length > record_len - buffer_offset) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: Frame length %u > record frame data %u", + *err_info = ws_strdup_printf("k12: Frame length %u > record frame data %u", length, record_len - buffer_offset); return FALSE; } @@ -699,7 +699,7 @@ static gboolean k12_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, gchar } else if (len < K12_RECORD_SRC_ID + 4) { /* Record not large enough to contain a src ID */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: Data record length %d too short", len); + *err_info = ws_strdup_printf("k12: Data record length %d too short", len); return FALSE; } k12->num_of_records--; @@ -884,7 +884,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { file_data->num_of_records = pntoh32( header_buffer + K12_FILE_HDR_RECORD_COUNT_1 ); if ( file_data->num_of_records != pntoh32( header_buffer + K12_FILE_HDR_RECORD_COUNT_2 ) ) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: two different record counts, %u at 0x%02x and %u at 0x%02x", + *err_info = ws_strdup_printf("k12: two different record counts, %u at 0x%02x and %u at 0x%02x", file_data->num_of_records, K12_FILE_HDR_RECORD_COUNT_1, pntoh32( header_buffer + K12_FILE_HDR_RECORD_COUNT_2 ), @@ -926,7 +926,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { if (rec_len < K12_RECORD_TYPE + 4) { /* Record isn't long enough to have a type field */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: record length %u < %u", + *err_info = ws_strdup_printf("k12: record length %u < %u", rec_len, K12_RECORD_TYPE + 4); destroy_k12_file_data(file_data); return WTAP_OPEN_ERROR; @@ -958,7 +958,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { * of the source descriptor field. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: source descriptor record length %u < %u", + *err_info = ws_strdup_printf("k12: source descriptor record length %u < %u", rec_len, K12_SRCDESC_HWPART); destroy_k12_file_data(file_data); g_free(rec); @@ -991,7 +991,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { * field, including the variable-length parts. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: source descriptor record length %u < %u (%u + %u + %u + %u)", + *err_info = ws_strdup_printf("k12: source descriptor record length %u < %u (%u + %u + %u + %u)", rec_len, K12_SRCDESC_HWPART + hwpart_len + name_len + stack_len, K12_SRCDESC_HWPART, hwpart_len, name_len, stack_len); @@ -1004,7 +1004,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { if (hwpart_len < 4) { /* Hardware part isn't long enough to have a type field */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: source descriptor hardware part length %u < 4", + *err_info = ws_strdup_printf("k12: source descriptor hardware part length %u < 4", hwpart_len); destroy_k12_file_data(file_data); g_free(rec); @@ -1024,7 +1024,7 @@ wtap_open_return_val k12_open(wtap *wth, int *err, gchar **err_info) { if (hwpart_len < K12_SRCDESC_ATM_VCI + 2) { /* Hardware part isn't long enough to have ATM information */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("k12: source descriptor hardware part length %u < %u", + *err_info = ws_strdup_printf("k12: source descriptor hardware part length %u < %u", hwpart_len, K12_SRCDESC_ATM_VCI + 2); destroy_k12_file_data(file_data); diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c index c9357c0f56..6de5caac51 100644 --- a/wiretap/lanalyzer.c +++ b/wiretap/lanalyzer.c @@ -361,7 +361,7 @@ wtap_open_return_val lanalyzer_open(wtap *wth, int *err, gchar **err_info) case RT_Summary: if (record_length < sizeof summary) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("lanalyzer: summary record length %u is too short", + *err_info = ws_strdup_printf("lanalyzer: summary record length %u is too short", record_length); return WTAP_OPEN_ERROR; } @@ -406,14 +406,14 @@ wtap_open_return_val lanalyzer_open(wtap *wth, int *err, gchar **err_info) break; default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("lanalyzer: board type %u unknown", + *err_info = ws_strdup_printf("lanalyzer: board type %u unknown", board_type); return WTAP_OPEN_ERROR; } if (found_summary) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("lanalyzer: file has more than one summary record"); + *err_info = ws_strdup_printf("lanalyzer: file has more than one summary record"); return WTAP_OPEN_ERROR; } found_summary = TRUE; @@ -448,7 +448,7 @@ wtap_open_return_val lanalyzer_open(wtap *wth, int *err, gchar **err_info) done: if (!found_summary) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("lanalyzer: file has no summary record"); + *err_info = ws_strdup_printf("lanalyzer: file has no summary record"); return WTAP_OPEN_ERROR; } @@ -506,7 +506,7 @@ static gboolean lanalyzer_read_trace_record(wtap *wth, FILE_T fh, * after a Trace Packet Data Record, mark it as an error. */ if (record_type != RT_PacketData) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("lanalyzer: record type %u seen after trace summary record", + *err_info = ws_strdup_printf("lanalyzer: record type %u seen after trace summary record", record_type); return FALSE; } @@ -517,7 +517,7 @@ static gboolean lanalyzer_read_trace_record(wtap *wth, FILE_T fh, * descriptor. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("lanalyzer: file has a %u-byte record, too small to have even a packet descriptor", + *err_info = ws_strdup_printf("lanalyzer: file has a %u-byte record, too small to have even a packet descriptor", record_length); return FALSE; } diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index 9099c143c3..34e74137bf 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -217,7 +217,7 @@ wtap_open_return_val libpcap_open(wtap *wth, int *err, gchar **err_info) if (hdr.version_major < 2) { /* We only support version 2.0 and later. */ *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("pcap: major version %u unsupported", + *err_info = ws_strdup_printf("pcap: major version %u unsupported", hdr.version_major); return WTAP_OPEN_ERROR; } @@ -329,7 +329,7 @@ wtap_open_return_val libpcap_open(wtap *wth, int *err, gchar **err_info) file_encap = wtap_pcap_encap_to_wtap_encap(hdr.network & 0x03FFFFFF); if (file_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("pcap: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("pcap: network type %u unknown or unsupported", hdr.network); return WTAP_OPEN_ERROR; } @@ -853,7 +853,7 @@ libpcap_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, */ *err = WTAP_ERR_BAD_FILE; if (err_info != NULL) { - *err_info = g_strdup_printf("pcap: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("pcap: File has %u-byte packet, bigger than maximum of %u", hdr.hdr.incl_len, wtap_max_snaplen_for_encap(wth->file_encap)); } diff --git a/wiretap/log3gpp.c b/wiretap/log3gpp.c index 6b3d4a5321..5cab675eee 100644 --- a/wiretap/log3gpp.c +++ b/wiretap/log3gpp.c @@ -459,7 +459,7 @@ log3gpp_seek_read(wtap *wth, gint64 seek_off, /* If get here, must have failed */ *err = errno; - *err_info = g_strdup_printf("prot 3gpp: seek_read failed to read/parse " + *err_info = ws_strdup_printf("prot 3gpp: seek_read failed to read/parse " "line at position %" PRId64, seek_off); return FALSE; diff --git a/wiretap/logcat_text.c b/wiretap/logcat_text.c index 25f6907f1b..db982c8c50 100644 --- a/wiretap/logcat_text.c +++ b/wiretap/logcat_text.c @@ -108,28 +108,28 @@ static gchar *logcat_log(const struct dumper_t *dumper, guint32 seconds, switch (dumper->type) { case WTAP_ENCAP_LOGCAT_BRIEF: - return g_strdup_printf("%c/%-8s(%5i): %s\n", + return ws_strdup_printf("%c/%-8s(%5i): %s\n", priority, tag, pid, log); case WTAP_ENCAP_LOGCAT_PROCESS: /* NOTE: Last parameter should be "process name", not tag; Unfortunately, we do not have process name */ - return g_strdup_printf("%c(%5i) %s (%s)\n", + return ws_strdup_printf("%c(%5i) %s (%s)\n", priority, pid, log, ""); case WTAP_ENCAP_LOGCAT_TAG: - return g_strdup_printf("%c/%-8s: %s\n", + return ws_strdup_printf("%c/%-8s: %s\n", priority, tag, log); case WTAP_ENCAP_LOGCAT_THREAD: - return g_strdup_printf("%c(%5i:%5i) %s\n", + return ws_strdup_printf("%c(%5i:%5i) %s\n", priority, pid, tid, log); case WTAP_ENCAP_LOGCAT_TIME: tm = gmtime(&datetime); if (tm != NULL) { strftime(time_buffer, sizeof(time_buffer), "%m-%d %H:%M:%S", tm); - return g_strdup_printf("%s.%03i %c/%-8s(%5i): %s\n", + return ws_strdup_printf("%s.%03i %c/%-8s(%5i): %s\n", time_buffer, milliseconds, priority, tag, pid, log); } else { - return g_strdup_printf("Not representable %c/%-8s(%5i): %s\n", + return ws_strdup_printf("Not representable %c/%-8s(%5i): %s\n", priority, tag, pid, log); } case WTAP_ENCAP_LOGCAT_THREADTIME: @@ -137,10 +137,10 @@ static gchar *logcat_log(const struct dumper_t *dumper, guint32 seconds, if (tm != NULL) { strftime(time_buffer, sizeof(time_buffer), "%m-%d %H:%M:%S", tm); - return g_strdup_printf("%s.%03i %5i %5i %c %-8s: %s\n", + return ws_strdup_printf("%s.%03i %5i %5i %c %-8s: %s\n", time_buffer, milliseconds, pid, tid, priority, tag, log); } else { - return g_strdup_printf("Not representable %5i %5i %c %-8s: %s\n", + return ws_strdup_printf("Not representable %5i %5i %c %-8s: %s\n", pid, tid, priority, tag, log); } case WTAP_ENCAP_LOGCAT_LONG: @@ -148,10 +148,10 @@ static gchar *logcat_log(const struct dumper_t *dumper, guint32 seconds, if (tm != NULL) { strftime(time_buffer, sizeof(time_buffer), "%m-%d %H:%M:%S", tm); - return g_strdup_printf("[ %s.%03i %5i:%5i %c/%-8s ]\n%s\n\n", + return ws_strdup_printf("[ %s.%03i %5i:%5i %c/%-8s ]\n%s\n\n", time_buffer, milliseconds, pid, tid, priority, tag, log); } else { - return g_strdup_printf("[ Not representable %5i:%5i %c/%-8s ]\n%s\n\n", + return ws_strdup_printf("[ Not representable %5i:%5i %c/%-8s ]\n%s\n\n", pid, tid, priority, tag, log); } default: @@ -522,7 +522,7 @@ static gboolean logcat_text_dump_text(wtap_dumper *wdh, msg_begin = msg_payload + msg_pre_skip; } else { *err = WTAP_ERR_UNWRITABLE_REC_DATA; - *err_info = g_strdup_printf("logcat: version %d isn't supported", + *err_info = ws_strdup_printf("logcat: version %d isn't supported", logcat_version); return FALSE; } diff --git a/wiretap/netmon.c b/wiretap/netmon.c index df3bf02c62..e3628d00b7 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -454,7 +454,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: major version %u unsupported", hdr.ver_major); + *err_info = ws_strdup_printf("netmon: major version %u unsupported", hdr.ver_major); return WTAP_OPEN_ERROR; } @@ -462,7 +462,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) if (hdr.network >= NUM_NETMON_ENCAPS || netmon_encap[hdr.network] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("netmon: network type %u unknown or unsupported", hdr.network); return WTAP_OPEN_ERROR; } @@ -554,13 +554,13 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) frame_table_size = frame_table_length / (guint32)sizeof (guint32); if ((frame_table_size * sizeof (guint32)) != frame_table_length) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: frame table length is %u, which is not a multiple of the size of an entry", + *err_info = ws_strdup_printf("netmon: frame table length is %u, which is not a multiple of the size of an entry", frame_table_length); return WTAP_OPEN_ERROR; } if (frame_table_size == 0) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: frame table length is %u, which means it's less than one entry in size", + *err_info = ws_strdup_printf("netmon: frame table length is %u, which means it's less than one entry in size", frame_table_length); return WTAP_OPEN_ERROR; } @@ -579,7 +579,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) */ if (frame_table_size > 512*1024*1024) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: frame table length is %u, which is larger than we support", + *err_info = ws_strdup_printf("netmon: frame table length is %u, which is larger than we support", frame_table_length); return WTAP_OPEN_ERROR; } @@ -600,21 +600,21 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) */ if (comment_table_size > 512*1024*1024) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: comment table size is %u, which is larger than we support", + *err_info = ws_strdup_printf("netmon: comment table size is %u, which is larger than we support", comment_table_size); return WTAP_OPEN_ERROR; } if (comment_table_size < 17) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: comment table size is %u, which is too small to use", + *err_info = ws_strdup_printf("netmon: comment table size is %u, which is too small to use", comment_table_size); return WTAP_OPEN_ERROR; } if (comment_table_offset > file_size) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: comment table offset (%u) is larger than file", + *err_info = ws_strdup_printf("netmon: comment table offset (%u) is larger than file", comment_table_offset); return WTAP_OPEN_ERROR; } @@ -631,14 +631,14 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) */ if (process_info_table_count > 512*1024) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: process info table size is %u, which is larger than we support", + *err_info = ws_strdup_printf("netmon: process info table size is %u, which is larger than we support", process_info_table_count); return WTAP_OPEN_ERROR; } if (process_info_table_offset > file_size) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: process info table offset (%u) is larger than file", + *err_info = ws_strdup_printf("netmon: process info table offset (%u) is larger than file", process_info_table_offset); return WTAP_OPEN_ERROR; } @@ -711,7 +711,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) } if (title_length > comment_table_size) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: comment title size is %u, which is larger than the amount remaining in the comment section (%u)", + *err_info = ws_strdup_printf("netmon: comment title size is %u, which is larger than the amount remaining in the comment section (%u)", title_length, comment_table_size); g_hash_table_destroy(comment_table); return WTAP_OPEN_ERROR; @@ -763,7 +763,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) /* Make sure comment size is sane */ if (comment_rec->descLength > comment_table_size) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: comment description size is %u, which is larger than the amount remaining in the comment section (%u)", + *err_info = ws_strdup_printf("netmon: comment description size is %u, which is larger than the amount remaining in the comment section (%u)", comment_rec->descLength, comment_table_size); g_hash_table_destroy(comment_table); return WTAP_OPEN_ERROR; @@ -823,7 +823,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info) path_size = pletoh32(&tmp32); if (path_size > MATH_PROCINFO_PATH_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: Path size for process info record is %u, which is larger than allowed max value (%u)", + *err_info = ws_strdup_printf("netmon: Path size for process info record is %u, which is larger than allowed max value (%u)", path_size, MATH_PROCINFO_PATH_SIZE); g_free(process_info); g_hash_table_destroy(process_info_table); @@ -1071,7 +1071,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("netmon: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FAILURE; } @@ -1095,7 +1095,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netmon: ATM file has a %u-byte packet, too small to have even an ATM pseudo-header", + *err_info = ws_strdup_printf("netmon: ATM file has a %u-byte packet, too small to have even an ATM pseudo-header", packet_size); return FAILURE; } @@ -1240,7 +1240,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, case 0xE089: // "Pef Ndis Msg"; case 0xE08A: // "Pef Ndis Wifi Meta Msg"; *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: network type %u unknown or unsupported", network); + *err_info = ws_strdup_printf("netmon: network type %u unknown or unsupported", network); return FAILURE; case 0xE083: pkt_encap = WTAP_ENCAP_MA_WFP_CAPTURE_V4; @@ -1273,7 +1273,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, pkt_encap = wtap_pcap_encap_to_wtap_encap(network); if (pkt_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: converted pcap network type %u unknown or unsupported", + *err_info = ws_strdup_printf("netmon: converted pcap network type %u unknown or unsupported", network); return FAILURE; } @@ -1284,7 +1284,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, pkt_encap = netmon_encap[network]; if (pkt_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("netmon: network type %u unknown or unsupported", network); return FAILURE; } @@ -1343,7 +1343,7 @@ netmon_process_record(wtap *wth, FILE_T fh, wtap_rec *rec, default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netmon: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("netmon: network type %u unknown or unsupported", network); return FAILURE; } diff --git a/wiretap/netscreen.c b/wiretap/netscreen.c index 084413b826..d0b6395cba 100644 --- a/wiretap/netscreen.c +++ b/wiretap/netscreen.c @@ -288,7 +288,7 @@ parse_netscreen_packet(FILE_T fh, wtap_rec *rec, Buffer* buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("netscreen: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("netscreen: File has %u-byte packet, bigger than maximum of %u", (guint)pkt_len, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/nettl.c b/wiretap/nettl.c index e9b43a82aa..e2b5a472c1 100644 --- a/wiretap/nettl.c +++ b/wiretap/nettl.c @@ -337,7 +337,7 @@ nettl_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, hdr_len = g_ntohs(rec_hdr.hdr_len); if (hdr_len < NETTL_REC_HDR_LEN) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettl: record header length %u too short", + *err_info = ws_strdup_printf("nettl: record header length %u too short", hdr_len); return FALSE; } @@ -537,7 +537,7 @@ nettl_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, if (length < padlen) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettl: packet length %u in record header too short, less than %u", + *err_info = ws_strdup_printf("nettl: packet length %u in record header too short, less than %u", length, padlen); return FALSE; } @@ -547,7 +547,7 @@ nettl_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, rec->rec_header.packet_header.len = length - padlen; if (caplen < padlen) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettl: captured length %u in record header too short, less than %u", + *err_info = ws_strdup_printf("nettl: captured length %u in record header too short, less than %u", caplen, padlen); return FALSE; } @@ -568,7 +568,7 @@ nettl_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettl: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("nettl: File has %u-byte packet, bigger than maximum of %u", rec->rec_header.packet_header.caplen, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/nettrace_3gpp_32_423.c b/wiretap/nettrace_3gpp_32_423.c index 235bfba2a2..7bf214514b 100644 --- a/wiretap/nettrace_3gpp_32_423.c +++ b/wiretap/nettrace_3gpp_32_423.c @@ -249,7 +249,7 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re /* We should always and only be called with a <msg....</msg> payload */ if (0 != strncmp(input, c_s_msg, CLEN(c_s_msg))) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Did not start with \"%s\"", c_s_msg); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Did not start with \"%s\"", c_s_msg); return FALSE; } @@ -288,7 +288,7 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re if (!next_msg_pos) { /* Something's wrong, bail out */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_e_msg); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_e_msg); status = FALSE; goto end; } @@ -331,7 +331,7 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re name_str_len = (int)(next_pos - curr_pos); if (name_str_len > MAX_NAME_LEN) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettrace_3gpp_32_423: name_str_len > %d", MAX_NAME_LEN); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: name_str_len > %d", MAX_NAME_LEN); goto end; } @@ -377,14 +377,14 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re raw_msg_pos = STRNSTR(start_msg_tag_cont, c_s_rawmsg); if (raw_msg_pos == NULL) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_s_rawmsg); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_s_rawmsg); status = FALSE; goto end; } curr_pos = STRNSTR(raw_msg_pos, c_protocol); if (curr_pos == NULL) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_protocol); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Did not find \"%s\"", c_protocol); status = FALSE; goto end; } @@ -612,7 +612,7 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re } else { /* Something wrong, bail out */ - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Could not parse hex data, bufsize %u index %u %c%c", + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Could not parse hex data, bufsize %u index %u %c%c", (pkt_data_len + exp_pdu_tags_len), i, chr1, @@ -681,7 +681,7 @@ nettrace_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, */ msg_start = g_strrstr_len(buf_start, (guint)(msg_end - buf_start), c_s_msg); if (msg_start == NULL || msg_start > msg_end) { - *err_info = g_strdup_printf("nettrace_3gpp_32_423: Found \"%s\" without matching \"%s\"", c_e_msg, c_s_msg); + *err_info = ws_strdup_printf("nettrace_3gpp_32_423: Found \"%s\" without matching \"%s\"", c_e_msg, c_s_msg); *err = WTAP_ERR_BAD_FILE; goto end; } diff --git a/wiretap/netxray.c b/wiretap/netxray.c index f62734420c..0aa59bc1e5 100644 --- a/wiretap/netxray.c +++ b/wiretap/netxray.c @@ -530,7 +530,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) file_type = netxray_2_00x_file_type_subtype; } else { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netxray: version \"%.8s\" unsupported", hdr.version); + *err_info = ws_strdup_printf("netxray: version \"%.8s\" unsupported", hdr.version); return WTAP_OPEN_ERROR; } } @@ -558,7 +558,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netxray: the byte after the network type has the value %u, which I don't understand", + *err_info = ws_strdup_printf("netxray: the byte after the network type has the value %u, which I don't understand", hdr.network_plus); return WTAP_OPEN_ERROR; } @@ -566,7 +566,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) if (network_type >= NUM_NETXRAY_ENCAPS || netxray_encap[network_type] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netxray: network type %u (%u) unknown or unsupported", + *err_info = ws_strdup_printf("netxray: network type %u (%u) unknown or unsupported", network_type, hdr.network_plus); return WTAP_OPEN_ERROR; } @@ -602,7 +602,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: /* "Can't happen" - we rejected that above */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("netxray: version %d.%d somehow didn't get rejected", + *err_info = ws_strdup_printf("netxray: version %d.%d somehow didn't get rejected", version_major, version_minor); return WTAP_OPEN_ERROR; } @@ -623,7 +623,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) case CAPTYPE_NDIS: if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for Ethernet/CAPTYPE_NDIS version %.8s capture", hdr.timeunit, hdr.version); return WTAP_OPEN_ERROR; @@ -647,7 +647,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS_GIGPOD || TpS_gigpod[hdr.timeunit] == 0.0) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for Ethernet/ETH_CAPTYPE_GIGPOD version %.8s capture", hdr.timeunit, hdr.version); return WTAP_OPEN_ERROR; @@ -667,7 +667,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS_OTHERPOD || TpS_otherpod[hdr.timeunit] == 0.0) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for Ethernet/ETH_CAPTYPE_OTHERPOD version %.8s capture", hdr.timeunit, hdr.version); return WTAP_OPEN_ERROR; @@ -687,7 +687,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS_OTHERPOD2 || TpS_otherpod2[hdr.timeunit] == 0.0) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for Ethernet/ETH_CAPTYPE_OTHERPOD2 version %.8s capture", hdr.timeunit, hdr.version); return WTAP_OPEN_ERROR; @@ -709,7 +709,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS_GIGPOD2 || TpS_gigpod2[hdr.timeunit] == 0.0) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for Ethernet/ETH_CAPTYPE_GIGPOD2 version %.8s capture", hdr.timeunit, hdr.version); return WTAP_OPEN_ERROR; @@ -729,7 +729,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown capture type %u for Ethernet version %.8s capture", hdr.captype, hdr.version); return WTAP_OPEN_ERROR; @@ -739,7 +739,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: if (hdr.timeunit >= NUM_NETXRAY_TIMEUNITS) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf( + *err_info = ws_strdup_printf( "netxray: Unknown timeunit %u for %u/%u version %.8s capture", hdr.timeunit, network_type, hdr.captype, hdr.version); @@ -766,7 +766,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) } else { /* "Can't happen" - we rejected that above */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("netxray: version %d.%d somehow didn't get rejected", + *err_info = ws_strdup_printf("netxray: version %d.%d somehow didn't get rejected", version_major, version_minor); return WTAP_OPEN_ERROR; } @@ -836,7 +836,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netxray: WAN HDLC capture subsubtype 0x%02x unknown or unsupported", + *err_info = ws_strdup_printf("netxray: WAN HDLC capture subsubtype 0x%02x unknown or unsupported", hdr.wan_hdlc_subsub_captype); return WTAP_OPEN_ERROR; } @@ -858,7 +858,7 @@ netxray_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("netxray: WAN capture subtype 0x%02x unknown or unsupported", + *err_info = ws_strdup_printf("netxray: WAN capture subtype 0x%02x unknown or unsupported", hdr.captype); return WTAP_OPEN_ERROR; } diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index bc92244235..22972740b6 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -613,7 +613,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info) if (version.network >= NUM_NGSNIFF_ENCAPS || sniffer_encap[version.network] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("ngsniffer: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("ngsniffer: network type %u unknown or unsupported", version.network); return WTAP_OPEN_ERROR; } @@ -621,7 +621,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info) /* Check the time unit */ if (version.timeunit >= NUM_NGSNIFF_TIMEUNITS) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("ngsniffer: Unknown timeunit %u", version.timeunit); + *err_info = ws_strdup_printf("ngsniffer: Unknown timeunit %u", version.timeunit); return WTAP_OPEN_ERROR; } @@ -911,7 +911,7 @@ process_rec_header2_v2(wtap *wth, unsigned char *buffer, guint16 length, wth->file_encap = WTAP_ENCAP_LAPB; } else { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("ngsniffer: WAN capture protocol string %.*s unknown", + *err_info = ws_strdup_printf("ngsniffer: WAN capture protocol string %.*s unknown", length, buffer); return -1; } @@ -1018,7 +1018,7 @@ process_rec_header2_v145(wtap *wth, unsigned char *buffer, guint16 length, * Reject these until we can figure them out. */ *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("ngsniffer: WAN network subtype %u unknown or unsupported", + *err_info = ws_strdup_printf("ngsniffer: WAN network subtype %u unknown or unsupported", buffer[4]); return -1; } diff --git a/wiretap/observer.c b/wiretap/observer.c index 2817fedd4f..03872a87aa 100644 --- a/wiretap/observer.c +++ b/wiretap/observer.c @@ -159,7 +159,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) * The packet data begins before the file header ends. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: The first packet begins in the middle of the file header"); + *err_info = ws_strdup_printf("Observer: The first packet begins in the middle of the file header"); return WTAP_OPEN_ERROR; } @@ -182,7 +182,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) * but we have the IE header to read. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: TLVs run into the first packet data"); + *err_info = ws_strdup_printf("Observer: TLVs run into the first packet data"); return WTAP_OPEN_ERROR; } @@ -194,7 +194,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) if (tlvh.length < sizeof tlvh) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (TLV length %u < %zu)", + *err_info = ws_strdup_printf("Observer: bad record (TLV length %u < %zu)", tlvh.length, sizeof tlvh); return WTAP_OPEN_ERROR; } @@ -210,7 +210,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) * but we have the IE data to read. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: TLVs run into the first packet data"); + *err_info = ws_strdup_printf("Observer: TLVs run into the first packet data"); return WTAP_OPEN_ERROR; } @@ -220,7 +220,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) case INFORMATION_TYPE_TIME_INFO: if (tlv_data_length != sizeof private_state->time_format) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (time information TLV length %u != %zu)", + *err_info = ws_strdup_printf("Observer: bad record (time information TLV length %u != %zu)", tlvh.length, sizeof tlvh + sizeof private_state->time_format); return WTAP_OPEN_ERROR; @@ -268,7 +268,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) * EOF, so there *are* no records. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: No records in the file, so we can't determine the link-layer type"); + *err_info = ws_strdup_printf("Observer: No records in the file, so we can't determine the link-layer type"); } return WTAP_OPEN_ERROR; } @@ -277,14 +277,14 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) /* check the packet's magic number */ if (packet_header.packet_magic != observer_packet_magic) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("Observer: unsupported packet version %ul", packet_header.packet_magic); + *err_info = ws_strdup_printf("Observer: unsupported packet version %ul", packet_header.packet_magic); return WTAP_OPEN_ERROR; } /* check the data link type */ if (observer_to_wtap_encap(packet_header.network_type) == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("Observer: network type %u unknown or unsupported", packet_header.network_type); + *err_info = ws_strdup_printf("Observer: network type %u unknown or unsupported", packet_header.network_type); return WTAP_OPEN_ERROR; } wth->file_encap = observer_to_wtap_encap(packet_header.network_type); @@ -307,7 +307,7 @@ wtap_open_return_val observer_open(wtap *wth, int *err, gchar **err_info) err_str = init_gmt_to_localtime_offset(); if (err_str != NULL) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("observer: %s", err_str); + *err_info = ws_strdup_printf("observer: %s", err_str); return WTAP_OPEN_ERROR; } @@ -442,7 +442,7 @@ read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header } *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record: Invalid magic number 0x%08x", + *err_info = ws_strdup_printf("Observer: bad record: Invalid magic number 0x%08x", packet_header->packet_magic); return -1; } @@ -475,7 +475,7 @@ read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header if (tlvh.length < sizeof tlvh) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (TLV length %u < %zu)", + *err_info = ws_strdup_printf("Observer: bad record (TLV length %u < %zu)", tlvh.length, sizeof tlvh); return -1; } @@ -486,7 +486,7 @@ read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header case INFORMATION_TYPE_WIRELESS: if (tlv_data_length != sizeof wireless_header) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (wireless TLV length %u != %zu)", + *err_info = ws_strdup_printf("Observer: bad record (wireless TLV length %u != %zu)", tlvh.length, sizeof tlvh + sizeof wireless_header); return -1; } @@ -575,7 +575,7 @@ process_packet_header(wtap *wth, packet_entry_header *packet_header, */ if (packet_header->network_size < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record: Packet length %u < 4", + *err_info = ws_strdup_printf("Observer: bad record: Packet length %u < 4", packet_header->network_size); return FALSE; } @@ -632,7 +632,7 @@ read_packet_data(FILE_T fh, int offset_to_frame, int current_offset_from_packet_ /* validate offsets */ if (offset_to_frame < current_offset_from_packet_header) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (offset to packet data %d < %d)", + *err_info = ws_strdup_printf("Observer: bad record (offset to packet data %d < %d)", offset_to_frame, current_offset_from_packet_header); return -1; } @@ -663,7 +663,7 @@ skip_to_next_packet(wtap *wth, int offset_to_next_packet, int current_offset_fro /* validate offsets */ if (offset_to_next_packet < current_offset_from_packet_header) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("Observer: bad record (offset to next packet %d < %d)", + *err_info = ws_strdup_printf("Observer: bad record (offset to next packet %d < %d)", offset_to_next_packet, current_offset_from_packet_header); return FALSE; } @@ -797,7 +797,7 @@ static gboolean observer_dump_open(wtap_dumper *wdh, int *err, err_str = init_gmt_to_localtime_offset(); if (err_str != NULL) { *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("observer: %s", err_str); + *err_info = ws_strdup_printf("observer: %s", err_str); return FALSE; } diff --git a/wiretap/packetlogger.c b/wiretap/packetlogger.c index 54cdec3900..a657903640 100644 --- a/wiretap/packetlogger.c +++ b/wiretap/packetlogger.c @@ -351,7 +351,7 @@ packetlogger_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, if (pl_hdr.len < 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("packetlogger: record length %u is too small", pl_hdr.len); + *err_info = ws_strdup_printf("packetlogger: record length %u is too small", pl_hdr.len); return FALSE; } if (pl_hdr.len - 8 > WTAP_MAX_PACKET_SIZE_STANDARD) { @@ -360,7 +360,7 @@ packetlogger_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("packetlogger: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("packetlogger: File has %u-byte packet, bigger than maximum of %u", pl_hdr.len - 8, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c index 2f9a1dcfab..5c28343061 100644 --- a/wiretap/pcap-common.c +++ b/wiretap/pcap-common.c @@ -808,7 +808,7 @@ pcap_read_nokiaatm_pseudoheader(FILE_T fh, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: Nokia IPSO ATM file has a %u-byte packet, too small to have even an ATM pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: Nokia IPSO ATM file has a %u-byte packet, too small to have even an ATM pseudo-header", packet_size); return -1; } @@ -855,7 +855,7 @@ pcap_read_sunatm_pseudoheader(FILE_T fh, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: SunATM file has a %u-byte packet, too small to have even an ATM pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: SunATM file has a %u-byte packet, too small to have even an ATM pseudo-header", packet_size); return -1; } @@ -999,7 +999,7 @@ pcap_read_irda_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: IrDA file has a %u-byte packet, too small to have even an IrDA pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: IrDA file has a %u-byte packet, too small to have even an IrDA pseudo-header", packet_size); return -1; } @@ -1056,7 +1056,7 @@ pcap_read_mtp2_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: MTP2 file has a %u-byte packet, too small to have even an MTP2 pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: MTP2 file has a %u-byte packet, too small to have even an MTP2 pseudo-header", packet_size); return -1; } @@ -1116,7 +1116,7 @@ pcap_read_lapd_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: LAPD file has a %u-byte packet, too small to have even a LAPD pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: LAPD file has a %u-byte packet, too small to have even a LAPD pseudo-header", packet_size); return -1; } @@ -1178,7 +1178,7 @@ pcap_read_sita_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: SITA file has a %u-byte packet, too small to have even a SITA pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: SITA file has a %u-byte packet, too small to have even a SITA pseudo-header", packet_size); return -1; } @@ -1238,7 +1238,7 @@ pcap_read_bt_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: Bluetooth file has a %u-byte packet, too small to have even a pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: Bluetooth file has a %u-byte packet, too small to have even a pseudo-header", packet_size); return -1; } @@ -1286,7 +1286,7 @@ pcap_read_bt_monitor_pseudoheader(FILE_T fh, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: Bluetooth monitor file has a %u-byte packet, too small to have even a pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: Bluetooth monitor file has a %u-byte packet, too small to have even a pseudo-header", packet_size); return -1; } @@ -1330,7 +1330,7 @@ pcap_read_llcp_pseudoheader(FILE_T fh, if (packet_size < LLCP_HEADER_LEN) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: NFC LLCP file has a %u-byte packet, too small to have even a pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: NFC LLCP file has a %u-byte packet, too small to have even a pseudo-header", packet_size); return -1; } @@ -1377,7 +1377,7 @@ pcap_read_ppp_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: PPP file has a %u-byte packet, too small to have even a pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: PPP file has a %u-byte packet, too small to have even a pseudo-header", packet_size); return -1; } @@ -1418,7 +1418,7 @@ pcap_read_erf_pseudoheader(FILE_T fh, wtap_rec *rec, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to have even an ERF pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to have even an ERF pseudo-header", packet_size); return -1; } @@ -1469,13 +1469,13 @@ pcap_read_erf_pseudoheader(FILE_T fh, wtap_rec *rec, do { if (phdr_len > INT_MAX - 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", INT_MAX); return -1; } if (packet_size < (guint)phdr_len + 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the extension headers", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the extension headers", packet_size); return -1; } @@ -1505,13 +1505,13 @@ pcap_read_erf_pseudoheader(FILE_T fh, wtap_rec *rec, /* Extract the Multi Channel header to include it in the pseudo header part */ if (phdr_len > INT_MAX - (int)sizeof(erf_mc_header_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", INT_MAX); return -1; } if (packet_size < (guint)(phdr_len + (int)sizeof(erf_mc_header_t))) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the Multi Channel header", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the Multi Channel header", packet_size); return -1; } @@ -1524,13 +1524,13 @@ pcap_read_erf_pseudoheader(FILE_T fh, wtap_rec *rec, /* Extract the AAL2 header to include it in the pseudo header part */ if (phdr_len > INT_MAX - (int)sizeof(erf_aal2_header_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", INT_MAX); return -1; } if (packet_size < (guint)(phdr_len + (int)sizeof(erf_aal2_header_t))) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the AAL2 header", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the AAL2 header", packet_size); return -1; } @@ -1546,13 +1546,13 @@ pcap_read_erf_pseudoheader(FILE_T fh, wtap_rec *rec, /* Extract the Ethernet additional header to include it in the pseudo header part */ if (phdr_len > INT_MAX - (int)sizeof(erf_eth_header_t)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a packet larger than %d bytes", INT_MAX); return -1; } if (packet_size < (guint)(phdr_len + (int)sizeof(erf_eth_header_t))) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the Ethernet additional header", + *err_info = ws_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to include the Ethernet additional header", packet_size); return -1; } @@ -1682,7 +1682,7 @@ pcap_read_i2c_linux_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_hea * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcap/pcapng: I2C file has a %u-byte packet, too small to have even a I2C pseudo-header", + *err_info = ws_strdup_printf("pcap/pcapng: I2C file has a %u-byte packet, too small to have even a I2C pseudo-header", packet_size); return -1; } diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index 8af358d1a0..604b348e09 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -797,7 +797,7 @@ pcapng_process_custom_option(wtapng_block_t *wblock, if (option_length < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: option length (%d) too small for custom option", + *err_info = ws_strdup_printf("pcapng: option length (%d) too small for custom option", option_length); return FALSE; } @@ -826,7 +826,7 @@ pcapng_process_custom_option(wtapng_block_t *wblock, * us. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("pcapng: invalid byte order %d passed to pcapng_process_custom_option()", + *err_info = ws_strdup_printf("pcapng: invalid byte order %d passed to pcapng_process_custom_option()", byte_order); return FALSE; } @@ -934,7 +934,7 @@ pcapng_process_options(FILE_T fh, wtapng_block_t *wblock, /* Sanity check: don't run past the end of the options. */ if (sizeof (*oh) > opt_bytes_remaining) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: Not enough data for option header"); + *err_info = ws_strdup_printf("pcapng: Not enough data for option header"); g_free(option_content); return FALSE; } @@ -962,7 +962,7 @@ pcapng_process_options(FILE_T fh, wtapng_block_t *wblock, default: /* Don't do that. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("pcapng: invalid byte order %d passed to pcapng_process_options()", + *err_info = ws_strdup_printf("pcapng: invalid byte order %d passed to pcapng_process_options()", byte_order); return FALSE; } @@ -975,7 +975,7 @@ pcapng_process_options(FILE_T fh, wtapng_block_t *wblock, /* Sanity check: don't run past the end of the options. */ if (rounded_option_length > opt_bytes_remaining) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: Not enough data to handle option of length %u", + *err_info = ws_strdup_printf("pcapng: Not enough data to handle option of length %u", option_length); g_free(option_content); return FALSE; @@ -1129,7 +1129,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh, default: /* Not a "pcapng" magic number we know about. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: unknown byte-order magic number 0x%08x", shb.magic); + *err_info = ws_strdup_printf("pcapng: unknown byte-order magic number 0x%08x", shb.magic); /* * See above comment about PCAPNG_BLOCK_NOT_SHB. @@ -1153,7 +1153,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an SHB is less than the minimum SHB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an SHB is less than the minimum SHB size %u", bh->block_total_length, MIN_SHB_SIZE); return PCAPNG_BLOCK_ERROR; } @@ -1170,7 +1170,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh, likely to be treated as bad pcapng files. */ if (bh->block_total_length > MAX_BLOCK_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u is too large (> %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u is too large (> %u)", bh->block_total_length, MAX_BLOCK_SIZE); return PCAPNG_BLOCK_ERROR; } @@ -1192,7 +1192,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh, if (!(version_major == 1 && (version_minor == 0 || version_minor == 2))) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("pcapng: unknown SHB version %u.%u", + *err_info = ws_strdup_printf("pcapng: unknown SHB version %u.%u", version_major, version_minor); return PCAPNG_BLOCK_ERROR; } @@ -1284,7 +1284,7 @@ pcapng_process_if_descr_block_option(wtapng_block_t *wblock, case(OPT_IDB_FILTER): /* if_filter */ if (option_length < 1) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block verdict option length %u is < 1", + *err_info = ws_strdup_printf("pcapng: packet block verdict option length %u is < 1", option_length); /* XXX - free anything? */ return FALSE; @@ -1436,7 +1436,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an IDB is less than the minimum IDB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an IDB is less than the minimum IDB size %u", bh->block_total_length, MIN_IDB_SIZE); return FALSE; } @@ -1610,7 +1610,7 @@ pcapng_read_decryption_secrets_block(FILE_T fh, pcapng_block_header_t *bh, /* Sanity check: assume the secrets are not larger than 1 GiB */ if (dsb_mand->secrets_len > 1024 * 1024 * 1024) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: secrets block is too large: %u", dsb_mand->secrets_len); + *err_info = ws_strdup_printf("pcapng: secrets block is too large: %u", dsb_mand->secrets_len); return FALSE; } dsb_mand->secrets_data = (guint8 *)g_malloc0(dsb_mand->secrets_len); @@ -1666,7 +1666,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_EPB_FLAGS): if (option_length != 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block flags option length %u is not 4", + *err_info = ws_strdup_printf("pcapng: packet block flags option length %u is not 4", option_length); /* XXX - free anything? */ return FALSE; @@ -1683,7 +1683,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_EPB_DROPCOUNT): if (option_length != 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block drop count option length %u is not 8", + *err_info = ws_strdup_printf("pcapng: packet block drop count option length %u is not 8", option_length); /* XXX - free anything? */ return FALSE; @@ -1696,7 +1696,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_EPB_PACKETID): if (option_length != 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block packet id option length %u is not 8", + *err_info = ws_strdup_printf("pcapng: packet block packet id option length %u is not 8", option_length); /* XXX - free anything? */ return FALSE; @@ -1709,7 +1709,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_EPB_QUEUE): if (option_length != 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block queue option length %u is not 4", + *err_info = ws_strdup_printf("pcapng: packet block queue option length %u is not 4", option_length); /* XXX - free anything? */ return FALSE; @@ -1722,7 +1722,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_EPB_VERDICT): if (option_length < 1) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block verdict option length %u is < 1", + *err_info = ws_strdup_printf("pcapng: packet block verdict option length %u is < 1", option_length); /* XXX - free anything? */ return FALSE; @@ -1740,7 +1740,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_VERDICT_TYPE_TC): if (option_length != 9) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block TC verdict option length %u is != 9", + *err_info = ws_strdup_printf("pcapng: packet block TC verdict option length %u is != 9", option_length); /* XXX - free anything? */ return FALSE; @@ -1759,7 +1759,7 @@ pcapng_process_packet_block_option(wtapng_block_t *wblock, case(OPT_VERDICT_TYPE_XDP): if (option_length != 9) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: packet block XDP verdict option length %u is != 9", + *err_info = ws_strdup_printf("pcapng: packet block XDP verdict option length %u is != 9", option_length); /* XXX - free anything? */ return FALSE; @@ -1826,7 +1826,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an EPB is less than the minimum EPB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an EPB is less than the minimum EPB size %u", bh->block_total_length, MIN_EPB_SIZE); return FALSE; } @@ -1862,7 +1862,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a PB is less than the minimum PB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of a PB is less than the minimum PB size %u", bh->block_total_length, MIN_PB_SIZE); return FALSE; } @@ -1909,7 +1909,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an EPB is too small for %u bytes of packet data", + *err_info = ws_strdup_printf("pcapng: total block length %u of an EPB is too small for %u bytes of packet data", bh->block_total_length, packet.cap_len); return FALSE; } @@ -1920,7 +1920,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a PB is too small for %u bytes of packet data", + *err_info = ws_strdup_printf("pcapng: total block length %u of a PB is too small for %u bytes of packet data", bh->block_total_length, packet.cap_len); return FALSE; } @@ -1933,7 +1933,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, if (packet.interface_id >= section_info->interfaces->len) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: interface index %u is not less than section interface count %u", + *err_info = ws_strdup_printf("pcapng: interface index %u is not less than section interface count %u", packet.interface_id, section_info->interfaces->len); return FALSE; @@ -1943,7 +1943,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, if (packet.cap_len > wtap_max_snaplen_for_encap(iface_info.wtap_encap)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: cap_len %u is larger than %u", + *err_info = ws_strdup_printf("pcapng: cap_len %u is larger than %u", packet.cap_len, wtap_max_snaplen_for_encap(iface_info.wtap_encap)); return FALSE; @@ -2064,7 +2064,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an SPB is less than the minimum SPB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an SPB is less than the minimum SPB size %u", bh->block_total_length, MIN_SPB_SIZE); return FALSE; } @@ -2117,14 +2117,14 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, * not a *minimum* length. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an SPB is too small for %u bytes of packet data", + *err_info = ws_strdup_printf("pcapng: total block length %u of an SPB is too small for %u bytes of packet data", bh->block_total_length, simple_packet.packet_len); return FALSE; } if (simple_packet.cap_len > wtap_max_snaplen_for_encap(iface_info.wtap_encap)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: cap_len %u is larger than %u", + *err_info = ws_strdup_printf("pcapng: cap_len %u is larger than %u", simple_packet.cap_len, wtap_max_snaplen_for_encap(iface_info.wtap_encap)); return FALSE; @@ -2294,7 +2294,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an NRB is less than the minimum NRB size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an NRB is less than the minimum NRB size %u", bh->block_total_length, MIN_NRB_SIZE); return FALSE; } @@ -2322,7 +2322,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, if ((size_t)(to_read - block_read) < sizeof nrb) { ws_buffer_free(&nrb_rec); *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: %d bytes left in the block < NRB record header size %u", + *err_info = ws_strdup_printf("pcapng: %d bytes left in the block < NRB record header size %u", to_read - block_read, (guint)sizeof nrb); return FALSE; @@ -2342,7 +2342,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, if (to_read - block_read < nrb.record_len + PADDING4(nrb.record_len)) { ws_buffer_free(&nrb_rec); *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: %d bytes left in the block < NRB record length + padding %u", + *err_info = ws_strdup_printf("pcapng: %d bytes left in the block < NRB record length + padding %u", to_read - block_read, nrb.record_len + PADDING4(nrb.record_len)); return FALSE; @@ -2370,7 +2370,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, if (nrb.record_len < 4) { ws_buffer_free(&nrb_rec); *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: NRB record length for IPv4 record %u < minimum length 4", + *err_info = ws_strdup_printf("pcapng: NRB record length for IPv4 record %u < minimum length 4", nrb.record_len); return FALSE; } @@ -2432,14 +2432,14 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, if (nrb.record_len < 16) { ws_buffer_free(&nrb_rec); *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: NRB record length for IPv6 record %u < minimum length 16", + *err_info = ws_strdup_printf("pcapng: NRB record length for IPv6 record %u < minimum length 16", nrb.record_len); return FALSE; } if (to_read < nrb.record_len) { ws_buffer_free(&nrb_rec); *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: NRB record length for IPv6 record %u > remaining data in NRB", + *err_info = ws_strdup_printf("pcapng: NRB record length for IPv6 record %u > remaining data in NRB", nrb.record_len); return FALSE; } @@ -2603,7 +2603,7 @@ pcapng_read_interface_statistics_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an ISB is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of an ISB is too small (< %u)", bh->block_total_length, MIN_ISB_SIZE); return FALSE; } @@ -2671,7 +2671,7 @@ pcapng_read_nflx_custom_block(FILE_T fh, pcapng_block_header_t *bh, if (bh->block_total_length < MIN_NFLX_CB_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a Netflix CB is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of a Netflix CB is too small (< %u)", bh->block_total_length, MIN_NFLX_CB_SIZE); return FALSE; } @@ -2704,7 +2704,7 @@ pcapng_read_nflx_custom_block(FILE_T fh, pcapng_block_header_t *bh, */ if (bh->block_total_length < MIN_NFLX_CB_SIZE + (guint32)sizeof(guint32)) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a Netflix skip CB is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of a Netflix skip CB is too small (< %u)", bh->block_total_length, MIN_NFLX_CB_SIZE + (guint32)sizeof(guint32)); return FALSE; @@ -2778,7 +2778,7 @@ pcapng_read_custom_block(FILE_T fh, pcapng_block_header_t *bh, * No. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a CB is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of a CB is too small (< %u)", bh->block_total_length, MIN_CB_SIZE); return FALSE; } @@ -2844,7 +2844,7 @@ pcapng_read_sysdig_event_block(FILE_T fh, pcapng_block_header_t *bh, if (bh->block_total_length < min_event_size) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a Sysdig event block is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of a Sysdig event block is too small (< %u)", bh->block_total_length, min_event_size); return FALSE; } @@ -2937,7 +2937,7 @@ pcapng_read_systemd_journal_export_block(wtap *wth, FILE_T fh, pcapng_block_head if (bh->block_total_length < MIN_SYSTEMD_JOURNAL_EXPORT_BLOCK_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of a systemd journal export block is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u of a systemd journal export block is too small (< %u)", bh->block_total_length, MIN_SYSTEMD_JOURNAL_EXPORT_BLOCK_SIZE); return FALSE; } @@ -2963,7 +2963,7 @@ pcapng_read_systemd_journal_export_block(wtap *wth, FILE_T fh, pcapng_block_head if (entry_length < MIN_SYSTEMD_JOURNAL_EXPORT_ENTRY_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: entry length %u is too small (< %u)", + *err_info = ws_strdup_printf("pcapng: entry length %u is too small (< %u)", bh->block_total_length, MIN_SYSTEMD_JOURNAL_EXPORT_ENTRY_SIZE); return FALSE; } @@ -3032,7 +3032,7 @@ pcapng_read_unknown_block(FILE_T fh, pcapng_block_header_t *bh, if (bh->block_total_length < MIN_BLOCK_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u of an unknown block type is less than the minimum block size %u", + *err_info = ws_strdup_printf("pcapng: total block length %u of an unknown block type is less than the minimum block size %u", bh->block_total_length, MIN_BLOCK_SIZE); return FALSE; } @@ -3100,7 +3100,7 @@ pcapng_read_and_check_block_trailer(FILE_T fh, pcapng_block_header_t *bh, if (block_total_length != bh->block_total_length) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block lengths (first %u and second %u) don't match", + *err_info = ws_strdup_printf("pcapng: total block lengths (first %u and second %u) don't match", bh->block_total_length, block_total_length); return FALSE; } @@ -3216,7 +3216,7 @@ pcapng_read_block(wtap *wth, FILE_T fh, pcapng_t *pn, We do that by imposing a maximum block size of MAX_BLOCK_SIZE. */ if (bh.block_total_length > MAX_BLOCK_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pcapng: total block length %u is too large (> %u)", + *err_info = ws_strdup_printf("pcapng: total block length %u is too large (> %u)", bh.block_total_length, MAX_BLOCK_SIZE); return FALSE; } @@ -4848,7 +4848,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec, * Our caller is doing something bad. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("pcapng: epb.interface_id (%u) >= wdh->interface_data->len (%u)", + *err_info = ws_strdup_printf("pcapng: epb.interface_id (%u) >= wdh->interface_data->len (%u)", epb.interface_id, wdh->interface_data->len); return FALSE; } @@ -4860,7 +4860,7 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec, * Our caller is doing something bad. */ *err = WTAP_ERR_INTERNAL; - *err_info = g_strdup_printf("pcapng: interface %u encap %d != packet encap %d", + *err_info = ws_strdup_printf("pcapng: interface %u encap %d != packet encap %d", epb.interface_id, int_data_mand->wtap_encap, rec->rec_header.packet_header.pkt_encap); diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c index 4c0b3fb38f..3fffc80caa 100644 --- a/wiretap/peekclassic.c +++ b/wiretap/peekclassic.c @@ -499,7 +499,7 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh, */ if (rec->rec_header.packet_header.len < RADIO_INFO_SIZE || rec->rec_header.packet_header.caplen < RADIO_INFO_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("peekclassic: 802.11 packet has length < 4"); + *err_info = ws_strdup_printf("peekclassic: 802.11 packet has length < 4"); return -1; } rec->rec_header.packet_header.len -= RADIO_INFO_SIZE; @@ -551,7 +551,7 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh, */ if (rec->rec_header.packet_header.len < 4 || rec->rec_header.packet_header.caplen < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("peekclassic: 802.11 packet has length < 8"); + *err_info = ws_strdup_printf("peekclassic: 802.11 packet has length < 8"); return -1; } rec->rec_header.packet_header.len -= 4; diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c index f7d940d690..ef9bbbc568 100644 --- a/wiretap/peektagged.c +++ b/wiretap/peektagged.c @@ -299,7 +299,7 @@ wtap_open_return_val peektagged_open(wtap *wth, int *err, gchar **err_info) if (fileVersion != 9) { /* We only support version 9. */ *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("peektagged: version %u unsupported", + *err_info = ws_strdup_printf("peektagged: version %u unsupported", fileVersion); return WTAP_OPEN_ERROR; } @@ -352,7 +352,7 @@ wtap_open_return_val peektagged_open(wtap *wth, int *err, gchar **err_info) if (mediaSubType >= NUM_PEEKTAGGED_ENCAPS || peektagged_encap[mediaSubType] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("peektagged: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("peektagged: network type %u unknown or unsupported", mediaSubType); return WTAP_OPEN_ERROR; } @@ -725,7 +725,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("peektagged: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("peektagged: File has %u-byte packet, bigger than maximum of %u", sliceLength, WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -857,7 +857,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, else { if (rec->rec_header.packet_header.len < 4 || rec->rec_header.packet_header.caplen < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("peektagged: 802.11 packet has length < 4"); + *err_info = ws_strdup_printf("peektagged: 802.11 packet has length < 4"); return FALSE; } rec->rec_header.packet_header.pseudo_header.ieee_802_11.fcs_len = 0; @@ -876,7 +876,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, */ if (rec->rec_header.packet_header.len < 4 || rec->rec_header.packet_header.caplen < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("peektagged: Ethernet packet has length < 4"); + *err_info = ws_strdup_printf("peektagged: Ethernet packet has length < 4"); return FALSE; } rec->rec_header.packet_header.pseudo_header.eth.fcs_len = 0; diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c index 1ce6368fa0..94cbaa4c91 100644 --- a/wiretap/pppdump.c +++ b/wiretap/pppdump.c @@ -433,7 +433,7 @@ process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd, if (num_written > PPPD_BUF_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pppdump: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("pppdump: File has %u-byte packet, bigger than maximum of %u", num_written, PPPD_BUF_SIZE); return -1; } @@ -528,7 +528,7 @@ process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd, if (pkt->cnt >= PPPD_BUF_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pppdump: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("pppdump: File has %u-byte packet, bigger than maximum of %u", pkt->cnt - 1, PPPD_BUF_SIZE); return -1; } @@ -698,7 +698,7 @@ collate(pppdump_t* state, FILE_T fh, int *err, gchar **err_info, guint8 *pd, default: /* XXX - bad file */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("pppdump: bad ID byte 0x%02x", id); + *err_info = ws_strdup_printf("pppdump: bad ID byte 0x%02x", id); return FALSE; } diff --git a/wiretap/radcom.c b/wiretap/radcom.c index 28e78c5c11..1547a0ec21 100644 --- a/wiretap/radcom.c +++ b/wiretap/radcom.c @@ -201,7 +201,7 @@ wtap_open_return_val radcom_open(wtap *wth, int *err, gchar **err_info) wth->file_encap = WTAP_ENCAP_ATM_RFC1483; else { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("radcom: network type \"%.4s\" unknown", search_encap); + *err_info = ws_strdup_printf("radcom: network type \"%.4s\" unknown", search_encap); return WTAP_OPEN_ERROR; } diff --git a/wiretap/snoop.c b/wiretap/snoop.c index ee0d43d7da..cb2cd8910b 100644 --- a/wiretap/snoop.c +++ b/wiretap/snoop.c @@ -283,7 +283,7 @@ wtap_open_return_val snoop_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("snoop: version %u unsupported", hdr.version); + *err_info = ws_strdup_printf("snoop: version %u unsupported", hdr.version); return WTAP_OPEN_ERROR; } @@ -370,7 +370,7 @@ wtap_open_return_val snoop_open(wtap *wth, int *err, gchar **err_info) if (hdr.network >= NUM_SHOMITI_ENCAPS || shomiti_encap[hdr.network] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("snoop: Shomiti network type %u unknown or unsupported", + *err_info = ws_strdup_printf("snoop: Shomiti network type %u unknown or unsupported", hdr.network); return WTAP_OPEN_ERROR; } @@ -379,7 +379,7 @@ wtap_open_return_val snoop_open(wtap *wth, int *err, gchar **err_info) if ((hdr.network^SNOOP_PRIVATE_BIT) >= NUM_SNOOP_PRIVATE_ENCAPS || snoop_private_encap[hdr.network^SNOOP_PRIVATE_BIT] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("snoop: private network type %u unknown or unsupported", + *err_info = ws_strdup_printf("snoop: private network type %u unknown or unsupported", hdr.network); return WTAP_OPEN_ERROR; } @@ -388,7 +388,7 @@ wtap_open_return_val snoop_open(wtap *wth, int *err, gchar **err_info) if (hdr.network >= NUM_SNOOP_ENCAPS || snoop_encap[hdr.network] == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("snoop: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("snoop: network type %u unknown or unsupported", hdr.network); return WTAP_OPEN_ERROR; } @@ -517,7 +517,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: File has %u-byte original length, bigger than maximum of %u", + *err_info = ws_strdup_printf("snoop: File has %u-byte original length, bigger than maximum of %u", orig_size, WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -527,7 +527,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("snoop: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return -1; } @@ -536,7 +536,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * Probably a corrupt capture file. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: File has %u-byte packet, bigger than record size %u", + *err_info = ws_strdup_printf("snoop: File has %u-byte packet, bigger than record size %u", packet_size, rec_size); return -1; } @@ -556,7 +556,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: atmsnoop file has a %u-byte packet, too small to have even an ATM pseudo-header", + *err_info = ws_strdup_printf("snoop: atmsnoop file has a %u-byte packet, too small to have even an ATM pseudo-header", packet_size); return -1; } @@ -591,7 +591,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * have a pseudo-header. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: Shomiti wireless file has a %u-byte packet, too small to have even a wireless pseudo-header", + *err_info = ws_strdup_printf("snoop: Shomiti wireless file has a %u-byte packet, too small to have even a wireless pseudo-header", packet_size); return -1; } @@ -621,7 +621,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, * What, *negative* padding? Bogus. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: File has %u-byte record with packet size of %u", + *err_info = ws_strdup_printf("snoop: File has %u-byte record with packet size of %u", rec_size, packet_size); return -1; } @@ -751,7 +751,7 @@ snoop_read_shomiti_wireless_pseudoheader(FILE_T fh, */ if (whdr.pad[3] < 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("snoop: Header length in Surveyor record is %u, less than minimum of 8", + *err_info = ws_strdup_printf("snoop: Header length in Surveyor record is %u, less than minimum of 8", whdr.pad[3]); return FALSE; } diff --git a/wiretap/stanag4607.c b/wiretap/stanag4607.c index a22992af78..0edbcd1dd4 100644 --- a/wiretap/stanag4607.c +++ b/wiretap/stanag4607.c @@ -77,7 +77,7 @@ static gboolean stanag4607_read_file(wtap *wth, FILE_T fh, wtap_rec *rec, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("stanag4607: File has %" PRIu32 "d-byte packet, " + *err_info = ws_strdup_printf("stanag4607: File has %" PRIu32 "d-byte packet, " "bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } @@ -87,7 +87,7 @@ static gboolean stanag4607_read_file(wtap *wth, FILE_T fh, wtap_rec *rec, * infinitely if the size is zero. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("stanag4607: File has %" PRIu32 "d-byte packet, " + *err_info = ws_strdup_printf("stanag4607: File has %" PRIu32 "d-byte packet, " "smaller than minimum of %u", packet_size, PKT_HDR_SIZE+SEG_HDR_SIZE); return FALSE; } diff --git a/wiretap/systemd_journal.c b/wiretap/systemd_journal.c index 98f51ccd59..1cce5e5919 100644 --- a/wiretap/systemd_journal.c +++ b/wiretap/systemd_journal.c @@ -195,7 +195,7 @@ systemd_journal_read_export_entry(FILE_T fh, wtap_rec *rec, Buffer *buf, int *er // Start of binary data. if (fld_end >= MAX_EXPORT_ENTRY_LENGTH - 8) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("systemd: binary length too long"); + *err_info = ws_strdup_printf("systemd: binary length too long"); return FALSE; } guint64 data_len, le_data_len; @@ -207,7 +207,7 @@ systemd_journal_read_export_entry(FILE_T fh, wtap_rec *rec, Buffer *buf, int *er data_len = pletoh64(&le_data_len); if (data_len < 1 || data_len - 1 >= MAX_EXPORT_ENTRY_LENGTH - fld_end) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("systemd: binary data too long"); + *err_info = ws_strdup_printf("systemd: binary data too long"); return FALSE; } // Data + trailing \n diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c index 19baf7e562..97badfa004 100644 --- a/wiretap/toshiba.c +++ b/wiretap/toshiba.c @@ -308,7 +308,7 @@ parse_toshiba_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, * to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("toshiba: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("toshiba: File has %u-byte packet, bigger than maximum of %u", (guint)pkt_len, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/visual.c b/wiretap/visual.c index bc0ea26ad5..0897a55f3e 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -193,7 +193,7 @@ wtap_open_return_val visual_open(wtap *wth, int *err, gchar **err_info) if (vfile_hdr.file_version != 1) { *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("visual: file version %u unsupported", vfile_hdr.file_version); + *err_info = ws_strdup_printf("visual: file version %u unsupported", vfile_hdr.file_version); return WTAP_OPEN_ERROR; } @@ -234,7 +234,7 @@ wtap_open_return_val visual_open(wtap *wth, int *err, gchar **err_info) default: *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup_printf("visual: network type %u unknown or unsupported", + *err_info = ws_strdup_printf("visual: network type %u unknown or unsupported", vfile_hdr.media_type); return WTAP_OPEN_ERROR; } @@ -369,7 +369,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, if (rec->rec_header.packet_header.len < 4) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("visual: Ethernet packet has %u-byte original packet, less than the FCS length", + *err_info = ws_strdup_printf("visual: Ethernet packet has %u-byte original packet, less than the FCS length", rec->rec_header.packet_header.len); return FALSE; } @@ -385,7 +385,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, if (rec->rec_header.packet_header.len < 2) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("visual: Cisco HDLC packet has %u-byte original packet, less than the FCS length", + *err_info = ws_strdup_printf("visual: Cisco HDLC packet has %u-byte original packet, less than the FCS length", rec->rec_header.packet_header.len); return FALSE; } @@ -406,7 +406,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, if (rec->rec_header.packet_header.len < 2) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("visual: Frame Relay packet has %u-byte original packet, less than the FCS length", + *err_info = ws_strdup_printf("visual: Frame Relay packet has %u-byte original packet, less than the FCS length", rec->rec_header.packet_header.len); return FALSE; } @@ -421,7 +421,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, if (rec->rec_header.packet_header.len < 2) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("visual: Frame Relay packet has %u-byte original packet, less than the FCS length", + *err_info = ws_strdup_printf("visual: Frame Relay packet has %u-byte original packet, less than the FCS length", rec->rec_header.packet_header.len); return FALSE; } @@ -517,7 +517,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, /* Probably a corrupt capture file; don't blow up trying to allocate space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("visual: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("visual: File has %u-byte packet, bigger than maximum of %u", packet_size, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/vms.c b/wiretap/vms.c index 600282e506..00da6ff359 100644 --- a/wiretap/vms.c +++ b/wiretap/vms.c @@ -391,7 +391,7 @@ parse_vms_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, gchar **err_in if (!ws_strtou32(p, &endp, &pkt_len) || (*endp != '\0' && !g_ascii_isspace(*endp))) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("vms: Length field '%s' not valid", p); + *err_info = ws_strdup_printf("vms: Length field '%s' not valid", p); return FALSE; } break; @@ -404,7 +404,7 @@ parse_vms_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, gchar **err_in * space for an immensely-large packet. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("vms: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("vms: File has %u-byte packet, bigger than maximum of %u", pkt_len, WTAP_MAX_PACKET_SIZE_STANDARD); return FALSE; } diff --git a/wiretap/vwr.c b/wiretap/vwr.c index 0620074802..48272b2691 100644 --- a/wiretap/vwr.c +++ b/wiretap/vwr.c @@ -944,7 +944,7 @@ static gboolean vwr_read_rec_header(vwr_t *vwr, FILE_T fh, int *rec_size, int *I if ((f_len = decode_msg(vwr, header, &v_type, IS_TX, log_mode)) != 0) { if (f_len > B_SIZE) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("vwr: Invalid message record length %d", f_len); + *err_info = ws_strdup_printf("vwr: Invalid message record length %d", f_len); return FALSE; } else if (v_type != VT_FRAME) { @@ -1174,7 +1174,7 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, wtap_rec *record, * The record data must be large enough to hold the statistics trailer. */ if (rec_size < v22_W_STATS_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, v22_W_STATS_LEN); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1205,7 +1205,7 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, wtap_rec *record, * Report an error if it is. */ if (actual_octets > rec_size - v22_W_STATS_LEN) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1227,7 +1227,7 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, wtap_rec *record, if (actual_octets >= plcp_hdr_len) actual_octets -= plcp_hdr_len; else { - *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include %u-byte PLCP header)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (too short to include %u-byte PLCP header)", actual_octets, plcp_hdr_len); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1248,7 +1248,7 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, wtap_rec *record, */ if (actual_octets < 4) { if (actual_octets != 0) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include %u-byte PLCP header and 4 bytes of FCS)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (too short to include %u-byte PLCP header and 4 bytes of FCS)", actual_octets, plcp_hdr_len); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1453,7 +1453,7 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, wtap_rec *record, * the PLCP, and the statistics trailer. */ if ((guint)rec_size < vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN); *err = WTAP_ERR_BAD_FILE; @@ -1503,7 +1503,7 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, wtap_rec *record, * Report an error if it is. */ if (actual_octets > rec_size - (vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN)) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1649,7 +1649,7 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, wtap_rec *record, */ if (actual_octets < 4) { if (actual_octets != 0) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -1871,7 +1871,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, */ if (IS_TX == 3) { /*IS_TX =3, i.e., command type is RF Modified*/ if ((guint)rec_size < OCTO_MODIFIED_RF_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, OCTO_MODIFIED_RF_LEN); *err = WTAP_ERR_BAD_FILE; @@ -1918,7 +1918,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, { stats_offset = OCTO_RF_MOD_ACTUAL_LEN; if ((guint)rec_size < stats_offset + vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, stats_offset + vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN); *err = WTAP_ERR_BAD_FILE; @@ -1931,7 +1931,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, { stats_offset = 0; if ((guint)rec_size < vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN); *err = WTAP_ERR_BAD_FILE; @@ -2020,7 +2020,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, * Report an error if it is. */ if (actual_octets > rec_size - (stats_offset + vwr->MPDU_OFF + vVW510021_W_STATS_TRAILER_LEN)) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -2143,7 +2143,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, */ if (actual_octets < 4) { if (actual_octets != 0) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -2218,7 +2218,7 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, wtap_rec *record, * so that our caller doesn't blow up trying to allocate * space for an immensely-large packet. */ - *err_info = g_strdup_printf("vwr: File has %u-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("vwr: File has %u-byte packet, bigger than maximum of %u", record->rec_header.packet_header.caplen, WTAP_MAX_PACKET_SIZE_STANDARD); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -2582,7 +2582,7 @@ static gboolean vwr_read_rec_data_ethernet(vwr_t *vwr, wtap_rec *record, guint16 vw_flags; /* VeriWave-specific packet flags */ if ((guint)rec_size < vwr->STATS_LEN) { - *err_info = g_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, vwr->STATS_LEN); + *err_info = ws_strdup_printf("vwr: Invalid record length %d (must be at least %u)", rec_size, vwr->STATS_LEN); *err = WTAP_ERR_BAD_FILE; return FALSE; } @@ -2603,7 +2603,7 @@ static gboolean vwr_read_rec_data_ethernet(vwr_t *vwr, wtap_rec *record, * Report an error if it is. */ if (actual_octets > rec_size - vwr->STATS_LEN) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (runs past the end of the record)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; @@ -2655,7 +2655,7 @@ static gboolean vwr_read_rec_data_ethernet(vwr_t *vwr, wtap_rec *record, */ if (actual_octets < 4) { if (actual_octets != 0) { - *err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", + *err_info = ws_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)", actual_octets); *err = WTAP_ERR_BAD_FILE; return FALSE; diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h index 1c8c7fd65d..193808c45a 100644 --- a/wiretap/wtap-int.h +++ b/wiretap/wtap-int.h @@ -9,7 +9,7 @@ #ifndef __WTAP_INT_H__ #define __WTAP_INT_H__ -#include <glib.h> +#include "wtap.h" #include <time.h> #ifdef _WIN32 @@ -18,7 +18,6 @@ #include <wsutil/file_util.h> -#include "wtap.h" #include "wtap_opttypes.h" void wtap_init_file_type_subtypes(void); diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 1547b5dfaf..9f8308740d 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -1759,7 +1759,7 @@ wtap_full_file_read_file(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, int * * Avoid allocating space for an immensely-large file. */ *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("%s: File has %" PRId64 "-byte packet, bigger than maximum of %u", + *err_info = ws_strdup_printf("%s: File has %" PRId64 "-byte packet, bigger than maximum of %u", wtap_encap_name(wth->file_encap), file_size, G_MAXINT); return FALSE; } @@ -1773,7 +1773,7 @@ wtap_full_file_read_file(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, int * for (;;) { if (buffer_size <= 0) { *err = WTAP_ERR_BAD_FILE; - *err_info = g_strdup_printf("%s: Uncompressed file is bigger than maximum of %u", + *err_info = ws_strdup_printf("%s: Uncompressed file is bigger than maximum of %u", wtap_encap_name(wth->file_encap), G_MAXINT); return FALSE; } diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 1b2bf702ca..fca49eb67e 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -9,14 +9,12 @@ #ifndef __WTAP_H__ #define __WTAP_H__ -#include <glib.h> +#include <wireshark.h> #include <time.h> #include <wsutil/buffer.h> #include <wsutil/nstime.h> #include <wsutil/inet_addr.h> #include "wtap_opttypes.h" -#include "ws_symbol_export.h" -#include "ws_attributes.h" #ifdef __cplusplus extern "C" { diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c index 35056f2a4e..15522043e2 100644 --- a/wiretap/wtap_opttypes.c +++ b/wiretap/wtap_opttypes.c @@ -923,7 +923,7 @@ wtap_block_add_string_option_vformat(wtap_block_t block, guint option_id, const ret = wtap_block_add_option_common(block, option_id, WTAP_OPTTYPE_STRING, &opt); if (ret != WTAP_OPTTYPE_SUCCESS) return ret; - opt->value.stringval = g_strdup_vprintf(format, va); + opt->value.stringval = ws_strdup_vprintf(format, va); return WTAP_OPTTYPE_SUCCESS; } @@ -938,7 +938,7 @@ wtap_block_add_string_option_format(wtap_block_t block, guint option_id, const c if (ret != WTAP_OPTTYPE_SUCCESS) return ret; va_start(va, format); - opt->value.stringval = g_strdup_vprintf(format, va); + opt->value.stringval = ws_strdup_vprintf(format, va); va_end(va); return WTAP_OPTTYPE_SUCCESS; } @@ -1004,7 +1004,7 @@ wtap_block_set_string_option_value_format(wtap_block_t block, guint option_id, c } g_free(optval->stringval); va_start(va, format); - optval->stringval = g_strdup_vprintf(format, va); + optval->stringval = ws_strdup_vprintf(format, va); va_end(va); return WTAP_OPTTYPE_SUCCESS; } @@ -1021,7 +1021,7 @@ wtap_block_set_nth_string_option_value_format(wtap_block_t block, guint option_i return ret; g_free(optval->stringval); va_start(va, format); - optval->stringval = g_strdup_vprintf(format, va); + optval->stringval = ws_strdup_vprintf(format, va); va_end(va); return WTAP_OPTTYPE_SUCCESS; } |