aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/snmp
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2010-06-26 12:00:08 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2010-06-26 12:00:08 +0000
commit3f9a94d77344b7c110e91219b1907b905c18a472 (patch)
tree26406f17e166a0a6704d3bb1a876973d7d62818d /asn1/snmp
parentb040f1ac8c616a6a1b13b774cc0898b97665716b (diff)
Avoid crash when adding SNMP Users.
This fixes bug 4926. svn path=/trunk/; revision=33329
Diffstat (limited to 'asn1/snmp')
-rw-r--r--asn1/snmp/packet-snmp-template.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c
index 1d77ec7b30..f85e17e373 100644
--- a/asn1/snmp/packet-snmp-template.c
+++ b/asn1/snmp/packet-snmp-template.c
@@ -1112,12 +1112,12 @@ static snmp_ue_assoc_t* ue_se_dup(snmp_ue_assoc_t* o) {
#define CACHE_INSERT(c,a) if (c) { snmp_ue_assoc_t* t = c; c = a; c->next = t; } else { c = a; a->next = NULL; }
static void renew_ue_cache(void) {
+ localized_ues = NULL;
+ unlocalized_ues = NULL;
+
if (num_ueas) {
guint i;
- localized_ues = NULL;
- unlocalized_ues = NULL;
-
for(i = 0; i < num_ueas; i++) {
snmp_ue_assoc_t* a = ue_se_dup(&(ueas[i]));
@@ -1129,9 +1129,6 @@ static void renew_ue_cache(void) {
}
}
- } else {
- localized_ues = NULL;
- unlocalized_ues = NULL;
}
}
@@ -1920,6 +1917,10 @@ static void snmp_users_update_cb(void* p _U_, const char** err) {
*err = NULL;
+ if (num_ueas == 0)
+ /* Nothing to update */
+ return;
+
if (! ue->user.userName.len)
g_string_append_printf(es,"no userName\n");
@@ -2103,7 +2104,7 @@ void proto_register_snmp(void) {
snmp_users_copy_cb,
snmp_users_update_cb,
snmp_users_free_cb,
- renew_ue_cache,
+ renew_ue_cache,
users_fields);
static uat_field_t specific_traps_flds[] = {