aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-10-25 22:14:25 +0000
committerEvan Huus <eapache@gmail.com>2013-10-25 22:14:25 +0000
commit95f484a91ee34ea3caa2c325170e52d0bf07489b (patch)
tree83a02ff6f4f38f36c739e437881a432c75eb88b6 /asn1
parent7a3febacac8fd14009dc82dc4d139ee43d37a437 (diff)
Add a very small hack to make the UAT update callback error string freeable, and
convert all existing UAT update callbacks to use glib memory instead of ephemeral memory for that string. UAT code paths are entirely distinct from packet dissection, so using ephemeral memory was the wrong choice, because there was no guarantees about when it would be freed. The move away from emem still needs to be propogated deeper into the UAT code itself at some point. Net effect: remove another bunch of emem calls from dissectors, where replacing with wmem would have caused assertions. svn path=/trunk/; revision=52854
Diffstat (limited to 'asn1')
-rw-r--r--asn1/c1222/packet-c1222-template.c6
-rw-r--r--asn1/ldap/packet-ldap-template.c6
-rw-r--r--asn1/snmp/packet-snmp-template.c14
3 files changed, 13 insertions, 13 deletions
diff --git a/asn1/c1222/packet-c1222-template.c b/asn1/c1222/packet-c1222-template.c
index 92b2b57883..022b255108 100644
--- a/asn1/c1222/packet-c1222-template.c
+++ b/asn1/c1222/packet-c1222-template.c
@@ -673,7 +673,7 @@ static const TOP_ELEMENT_CONTROL canonifyTable[] = {
{ FALSE, FALSE, 0x0, TRUE, NULL, NULL }
};
-static void
+static void
clear_canon(void)
{
const TOP_ELEMENT_CONTROL *t = canonifyTable;
@@ -736,10 +736,10 @@ c1222_uat_data_update_cb(void* n, const char** err)
c1222_uat_data_t* new_rec = (c1222_uat_data_t *)n;
if (new_rec->keynum > 0xff) {
- *err = "Invalid key number; must be less than 256";
+ *err = g_strdup("Invalid key number; must be less than 256");
}
if (new_rec->keylen != EAX_SIZEOF_KEY) {
- *err = "Invalid key size; must be 16 bytes";
+ *err = g_strdup("Invalid key size; must be 16 bytes");
}
}
diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c
index ab5a6b78a2..33b32f31ad 100644
--- a/asn1/ldap/packet-ldap-template.c
+++ b/asn1/ldap/packet-ldap-template.c
@@ -408,13 +408,13 @@ attribute_types_update_cb(void *r, const char **err)
char c;
if (rec->attribute_type == NULL) {
- *err = wmem_strdup_printf(wmem_packet_scope(), "Attribute type can't be empty");
+ *err = g_strdup("Attribute type can't be empty");
return;
}
g_strstrip(rec->attribute_type);
if (rec->attribute_type[0] == 0) {
- *err = wmem_strdup_printf(wmem_packet_scope(), "Attribute type can't be empty");
+ *err = g_strdup("Attribute type can't be empty");
return;
}
@@ -423,7 +423,7 @@ attribute_types_update_cb(void *r, const char **err)
*/
c = proto_check_field_name(rec->attribute_type);
if (c) {
- *err = wmem_strdup_printf(wmem_packet_scope(), "Attribute type can't contain '%c'", c);
+ *err = g_strdup_printf("Attribute type can't contain '%c'", c);
return;
}
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c
index 54b2338d69..5e7456ed4f 100644
--- a/asn1/snmp/packet-snmp-template.c
+++ b/asn1/snmp/packet-snmp-template.c
@@ -2230,7 +2230,7 @@ static void
snmp_users_update_cb(void* p _U_, const char** err)
{
snmp_ue_assoc_t* ue = (snmp_ue_assoc_t*)p;
- emem_strbuf_t* es = ep_strbuf_new("");
+ GString* es = g_string_new("");
unsigned int i;
*err = NULL;
@@ -2240,14 +2240,14 @@ snmp_users_update_cb(void* p _U_, const char** err)
return;
if (! ue->user.userName.len)
- ep_strbuf_append_printf(es,"no userName\n");
+ g_string_append_printf(es,"no userName\n");
for (i=0; i<num_ueas-1; i++) {
snmp_ue_assoc_t* u = &(ueas[i]);
/* RFC 3411 section 5 */
if ((u->engine.len > 0) && (u->engine.len < 5 || u->engine.len > 32)) {
- ep_strbuf_append_printf(es, "Invalid engineId length (%u). Must be between 5 and 32 (10 and 64 hex digits)\n", u->engine.len);
+ g_string_append_printf(es, "Invalid engineId length (%u). Must be between 5 and 32 (10 and 64 hex digits)\n", u->engine.len);
}
@@ -2257,21 +2257,21 @@ snmp_users_update_cb(void* p _U_, const char** err)
if (u->engine.len > 0 && memcmp( u->engine.data, ue->engine.data, u->engine.len ) == 0) {
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
/* XXX: make a string for the engineId */
- ep_strbuf_append_printf(es,"Duplicate key (userName='%s')\n",ue->user.userName.data);
+ g_string_append_printf(es,"Duplicate key (userName='%s')\n",ue->user.userName.data);
}
}
if (u->engine.len == 0) {
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
- ep_strbuf_append_printf(es,"Duplicate key (userName='%s' engineId=NONE)\n",ue->user.userName.data);
+ g_string_append_printf(es,"Duplicate key (userName='%s' engineId=NONE)\n",ue->user.userName.data);
}
}
}
}
if (es->len) {
- es = ep_strbuf_truncate(es,es->len-1);
- *err = ep_strdup(es->str);
+ es = g_string_truncate(es,es->len-1);
+ *err = g_string_free(es, FALSE);
}
return;