forked from osmocom/wireshark
From Jakub Zawadzki:
Cleanup dissector code - use proper memory functions. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4164 svn path=/trunk/; revision=31408
This commit is contained in:
parent
02a69c1935
commit
7afd9b0c3b
|
@ -822,14 +822,8 @@ stats_account_string (string_counter_t **ret_list, const gchar *new_value)
|
|||
return (0);
|
||||
}
|
||||
|
||||
entry = ep_alloc (sizeof (*entry));
|
||||
if (entry == NULL)
|
||||
return (-1);
|
||||
memset (entry, 0, sizeof (*entry));
|
||||
|
||||
entry = ep_alloc0 (sizeof (*entry));
|
||||
entry->string = ep_strdup (new_value);
|
||||
if (entry->string == NULL)
|
||||
return (-1);
|
||||
entry->count = 1;
|
||||
entry->next = *ret_list;
|
||||
|
||||
|
|
|
@ -12483,8 +12483,7 @@ static void init_wepkeys(void) {
|
|||
wep_keylens[keyidx] = 0;
|
||||
|
||||
#ifdef USE_ENV
|
||||
buf=ep_alloc(128);
|
||||
g_snprintf(buf, 128, "WIRESHARK_WEPKEY%d", i+1);
|
||||
buf = ep_strdup_printf("WIRESHARK_WEPKEY%d", i+1);
|
||||
tmp = getenv(buf);
|
||||
#else
|
||||
tmp = wep_keystr[i];
|
||||
|
|
|
@ -717,8 +717,7 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
|
|||
keys. So just give it a copy of the crypto data instead.
|
||||
This has been seen for RC4-HMAC blobs.
|
||||
*/
|
||||
cryptocopy=g_malloc(length);
|
||||
memcpy(cryptocopy, cryptotext, length);
|
||||
cryptocopy=g_memdup(cryptotext, length);
|
||||
ret = krb5_decrypt_ivec(krb5_ctx, crypto, usage,
|
||||
cryptocopy, length,
|
||||
&data,
|
||||
|
@ -731,8 +730,7 @@ printf("woohoo decrypted keytype:%d in frame:%u\n", ek->keytype, pinfo->fd->num)
|
|||
proto_tree_add_text(tree, NULL, 0, 0, "[Decrypted using: %s]", ek->key_origin);
|
||||
krb5_crypto_destroy(krb5_ctx, crypto);
|
||||
/* return a private g_malloced blob to the caller */
|
||||
user_data=g_malloc(data.length);
|
||||
memcpy(user_data, data.data, data.length);
|
||||
user_data=g_memdup(data.data, data.length);
|
||||
if (datalen) {
|
||||
*datalen = data.length;
|
||||
}
|
||||
|
@ -772,8 +770,7 @@ printf("added key in %u\n",pinfo->fd->num);
|
|||
new_key->kvno = 0;
|
||||
new_key->keytype = keytype;
|
||||
new_key->length = keylength;
|
||||
new_key->contents = g_malloc(keylength);
|
||||
memcpy(new_key->contents, keyvalue, keylength);
|
||||
new_key->contents = g_memdup(keyvalue, keylength);
|
||||
g_snprintf(new_key->origin, KRB_MAX_ORIG_LEN, "%s learnt from frame %u", origin, pinfo->fd->num);
|
||||
service_key_list = g_slist_append(service_key_list, (gpointer) new_key);
|
||||
}
|
||||
|
@ -829,8 +826,7 @@ read_keytab_file(const char *service_key_file)
|
|||
sk->kvno = buf[0] << 8 | buf[1];
|
||||
sk->keytype = KEYTYPE_DES3_CBC_MD5;
|
||||
sk->length = DES3_KEY_SIZE;
|
||||
sk->contents = g_malloc(DES3_KEY_SIZE);
|
||||
memcpy(sk->contents, buf + 2, DES3_KEY_SIZE);
|
||||
sk->contents = g_memdup(buf + 2, DES3_KEY_SIZE);
|
||||
g_snprintf(sk->origin, KRB_MAX_ORIG_LEN, "3DES service key file, key #%d, offset %ld", count, ftell(skf));
|
||||
service_key_list = g_slist_append(service_key_list, (gpointer) sk);
|
||||
fseek(skf, newline_skip, SEEK_CUR);
|
||||
|
|
|
@ -609,9 +609,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset,
|
|||
}
|
||||
|
||||
if (string_data) {
|
||||
char *tmpstr;
|
||||
tmpstr = tvb_get_ephemeral_string(tvb, data_offset, string_length_copy);
|
||||
string_buffer = memcpy(ep_alloc(string_length_copy+1), tmpstr, string_length_copy);
|
||||
string_buffer = tvb_get_ephemeral_string(tvb, data_offset, string_length_copy);
|
||||
} else {
|
||||
string_buffer = tvb_memcpy(tvb, ep_alloc(string_length_copy+1), data_offset, string_length_copy);
|
||||
}
|
||||
|
@ -1663,12 +1661,9 @@ rpc_prog_info_value *rpc_prog = NULL;
|
|||
{ 0,NULL,NULL,NULL }
|
||||
};
|
||||
|
||||
NAME=g_malloc(36);
|
||||
Name=g_malloc(32);
|
||||
name=g_malloc(32);
|
||||
g_snprintf(NAME, 36, "Unknown RPC Program:%d",prpc_prog_key->prog);
|
||||
g_snprintf(Name, 32, "RPC:%d",prpc_prog_key->prog);
|
||||
g_snprintf(name, 32, "rpc%d",prpc_prog_key->prog);
|
||||
NAME = g_strdup_printf("Unknown RPC Program:%d",prpc_prog_key->prog);
|
||||
Name = g_strdup_printf("RPC:%d",prpc_prog_key->prog);
|
||||
name = g_strdup_printf("rpc%d",prpc_prog_key->prog);
|
||||
proto_rpc_unknown_program = proto_register_protocol(NAME, Name, name);
|
||||
|
||||
rpc_init_prog(proto_rpc_unknown_program, prpc_prog_key->prog, ett_rpc_unknown_program);
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#define UDP_PORT_TPNCP_HOST BASE_TPNCP_PORT
|
||||
|
||||
#define BASE_TPNCP_DATA_LEN 256
|
||||
#define MAX_TPNCP_DAT_FILE_PATH_LEN BASE_TPNCP_DATA_LEN
|
||||
#define MAX_TPNCP_DB_ENTRY_LEN BASE_TPNCP_DATA_LEN
|
||||
|
||||
#define MAX_TPNCP_DB_SIZE 3000
|
||||
|
@ -682,12 +681,10 @@ static gint init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info,
|
|||
/*-------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
static gint init_tpncp_db(void) {
|
||||
gchar *tpncp_dat_file_path = NULL;
|
||||
FILE *file = NULL;
|
||||
gchar *tpncp_dat_file_path;
|
||||
FILE *file;
|
||||
|
||||
tpncp_dat_file_path = ep_alloc(MAX_TPNCP_DAT_FILE_PATH_LEN);
|
||||
tpncp_dat_file_path[0] = 0;
|
||||
g_snprintf(tpncp_dat_file_path, MAX_TPNCP_DAT_FILE_PATH_LEN, "%s" G_DIR_SEPARATOR_S"tpncp" G_DIR_SEPARATOR_S "tpncp.dat", get_datafile_dir());
|
||||
tpncp_dat_file_path = ep_strdup_printf("%s" G_DIR_SEPARATOR_S"tpncp" G_DIR_SEPARATOR_S "tpncp.dat", get_datafile_dir());
|
||||
|
||||
/* Open file with TPNCP data. */
|
||||
if ((file = ws_fopen(tpncp_dat_file_path, "r")) == NULL)
|
||||
|
|
|
@ -450,11 +450,9 @@ vj_init(void)
|
|||
static slcompress *
|
||||
slhc_init(void)
|
||||
{
|
||||
slcompress *comp = se_alloc(sizeof(slcompress));
|
||||
slcompress *comp = se_alloc0(sizeof(slcompress));
|
||||
int i;
|
||||
|
||||
memset(comp, ZERO, sizeof(slcompress));
|
||||
|
||||
/*
|
||||
* Initialize the state; there is no current connection, and
|
||||
* we have no header data for any of the connections, as we
|
||||
|
|
Loading…
Reference in New Issue