/*
** For the states FLD2, BODY2 and FMTERR2 memory is allocated for f->value.
-** For the states LENERR2, ERR2 and FILEEOF2 no memory is allocated.
+** For the states LENERR2, IOERR2 and FILEEOF2 no memory is allocated.
*/
enum state
m_getfld2(enum state s, struct field *f, FILE *msg)
if (feof(msg)) {
return FILEEOF2;
} else {
- return ERR2;
+ return IOERR2;
}
}
nchars = getline(&tmpline, &len, msg);
if (nchars <= 0) {
free(tmpline);
- return ERR2;
+ return IOERR2;
}
if (nchars >= NAMESZ) {
if (falted == FAIL) {
free(tmpline);
- return ERR2;
+ return IOERR2;
}
free(tmpline);
copyname(char *dst, char *src)
{
size_t len;
- char *sep = strchr(src, ':');
+ char *cp, *sep;
- if (!sep) {
+ if (!(sep = strchr(src, ':'))) {
return 0;
}
+ /* whitespace is forbidden in name */
+ for (cp=src; cp<sep; cp++) {
+ if (isspace(*cp)) {
+ return 0;
+ }
+ }
len = sep - src;
if (len >= NAMESZ) {