char *s;
p = get_option(dhcp, option, &len, &type);
- if (!p)
+ if (!p || *p == '\0')
return NULL;
if (type & RFC3397) {
if (type & RFC3442)
return decode_rfc3442(s, len, dl, data);
- if (!type || type & STRING)
+ if (type & STRING) {
+ /* Some DHCP servers return NULL strings */
+ if (*data == '\0')
+ return 0;
return print_string(s, len, dl, data);
+ }
if (!s) {
if (type & UINT8)
e = strlen(prefix) + strlen(opt->var) + len + 4;
v = val = *ep++ = xmalloc(e);
v += snprintf(val, e, "%s_%s=", prefix, opt->var);
- print_option(v, len, opt->type, pl, p);
+ if (len != 0)
+ print_option(v, len, opt->type, pl, p);
}
return ep - env;