more error checks in menuitem.c
option value in ALPHA mode is treated special in menu_commands.c
This commit is contained in:
@@ -348,7 +348,7 @@ menu_set_item_func (Client * c, int argc, char **argv)
|
|||||||
{ MENUITEM_NUMERIC, "minvalue", INT, offsetof(MenuItem,data.numeric.minvalue) },
|
{ MENUITEM_NUMERIC, "minvalue", INT, offsetof(MenuItem,data.numeric.minvalue) },
|
||||||
{ MENUITEM_NUMERIC, "maxvalue", INT, offsetof(MenuItem,data.numeric.maxvalue) },
|
{ MENUITEM_NUMERIC, "maxvalue", INT, offsetof(MenuItem,data.numeric.maxvalue) },
|
||||||
/*{ MENUITEM_NUMERIC, "allow_decimals",BOOLEAN, offsetof(MenuItem,data.numeric.allow_decimals) },*/
|
/*{ MENUITEM_NUMERIC, "allow_decimals",BOOLEAN, offsetof(MenuItem,data.numeric.allow_decimals) },*/
|
||||||
{ MENUITEM_ALPHA, "value", STRING, offsetof(MenuItem,data.alpha.value) },
|
{ MENUITEM_ALPHA, "value", STRING, -1 /*offsetof(MenuItem,data.alpha.value)*/ },
|
||||||
{ MENUITEM_ALPHA, "minlength", SHORT, offsetof(MenuItem,data.alpha.minlength) },
|
{ MENUITEM_ALPHA, "minlength", SHORT, offsetof(MenuItem,data.alpha.minlength) },
|
||||||
{ MENUITEM_ALPHA, "maxlength", SHORT, offsetof(MenuItem,data.alpha.maxlength) },
|
{ MENUITEM_ALPHA, "maxlength", SHORT, offsetof(MenuItem,data.alpha.maxlength) },
|
||||||
{ MENUITEM_ALPHA, "password_char",STRING, -1 },
|
{ MENUITEM_ALPHA, "password_char",STRING, -1 },
|
||||||
|
|||||||
+4
-2
@@ -258,8 +258,10 @@ MenuItem *menuitem_create_alpha (char *id, MenuEventFunc(*event_func),
|
|||||||
new_item->data.alpha.allowed_extra = strdup (allowed_extra);
|
new_item->data.alpha.allowed_extra = strdup (allowed_extra);
|
||||||
|
|
||||||
new_item->data.alpha.value = malloc (maxlength + 1);
|
new_item->data.alpha.value = malloc (maxlength + 1);
|
||||||
strncpy (new_item->data.alpha.value, value, maxlength);
|
if (new_item->data.alpha.value != NULL) {
|
||||||
new_item->data.alpha.value[maxlength] = 0;
|
strncpy (new_item->data.alpha.value, value, maxlength);
|
||||||
|
new_item->data.alpha.value[maxlength] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
new_item->data.alpha.edit_str = malloc (maxlength + 1);
|
new_item->data.alpha.edit_str = malloc (maxlength + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user