Guard against empty names.

This commit is contained in:
Vreixo Formoso 2007-12-20 16:09:29 +01:00
parent e6bd1586d6
commit f2e3a2c9fc
2 changed files with 22 additions and 18 deletions

View File

@ -85,6 +85,10 @@ int iso_node_set_name(IsoNode *node, const char *name)
return ISO_NODE_NAME_NOT_UNIQUE; return ISO_NODE_NAME_NOT_UNIQUE;
} }
} }
/* guard against the empty string */
if (name[0] == '\0') {
return ISO_WRONG_ARG_VALUE;
}
new = strdup(name); new = strdup(name);
if (new == NULL) { if (new == NULL) {
return ISO_MEM_ERROR; return ISO_MEM_ERROR;