{
char *s;
+ assert(name);
+ assert(i >= 0 && i < ITEM_FIELDS);
+
if(strcasecmp(abook_fields[i].name, name)) { /* name differs */
/*
* check if we are overwriting statically allocated default
int i;
char keyname[21];
+ assert(name);
+
snprintf(keyname, sizeof(keyname), "custom%d", n);
for(i = CUSTOM_MIN; i <= CUSTOM_MAX; i++) {
return "unknown option";
}
+#include "database.h" /* needed for change_custom_field_name */
+
static char *
opt_parse_customfield(buffer *b)
{
memset(num, 0, sizeof(num));
- if((len = (b -> ptr - p)) > sizeof(num))
- return "invalid custom field number";
-
- strncpy(num, p, min(sizeof(num), len));
+ len = (b -> ptr - p);
+ strncpy(num, p, min(sizeof(num) - 1, len));
n = atoi(num);
find_token_start(b);