diff options
author | C. Davis <cd.rattan@gmail.com> | 2012-08-08 14:37:20 -0700 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-04-29 13:06:10 +0200 |
commit | 5cfbf7316c16c0205ff87f7980e05a2ab1671709 (patch) | |
tree | bff8eccb58de29bb61910d3b45f04495ec97d6b7 /source3/utils | |
parent | 360f31d52b30ef14e8a584f62ff61cc55c95ed53 (diff) | |
download | samba-5cfbf7316c16c0205ff87f7980e05a2ab1671709.tar.gz samba-5cfbf7316c16c0205ff87f7980e05a2ab1671709.tar.bz2 samba-5cfbf7316c16c0205ff87f7980e05a2ab1671709.zip |
regedit: Don't pass empty value names to new_item().
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/regedit_valuelist.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source3/utils/regedit_valuelist.c b/source3/utils/regedit_valuelist.c index c09b22107f..644375283d 100644 --- a/source3/utils/regedit_valuelist.c +++ b/source3/utils/regedit_valuelist.c @@ -194,6 +194,8 @@ WERROR value_list_load(struct value_list *vl, struct registry_key *key) struct value_item *vitem; ITEM **new_items; WERROR rv; + static const char *empty_name = "(empty)"; + const char *name; unpost_menu(vl->menu); @@ -237,8 +239,17 @@ WERROR value_list_load(struct value_list *vl, struct registry_key *key) return rv; } - new_items[idx] = new_item(vitem->value_name, - vitem->value_desc); + /* ncurses won't accept empty strings in menu items */ + name = vitem->value_name; + if (name[0] == '\0') { + name = empty_name; + } + new_items[idx] = new_item(name, vitem->value_desc); + if (new_items[idx] == NULL) { + talloc_free(vitem); + return WERR_NOMEM; + } + set_item_userptr(new_items[idx], vitem); } |