diff --git a/lib/getdef.c b/lib/getdef.c index 624a0566..5475b40e 100644 --- a/lib/getdef.c +++ b/lib/getdef.c @@ -268,10 +268,11 @@ getdef_num(const char *item, int dflt) * values are handled. */ -unsigned int getdef_unum (const char *item, unsigned int dflt) +unsigned int +getdef_unum(const char *item, unsigned int dflt) { - struct itemdef *d; - long val; + unsigned int val; + struct itemdef *d; if (!def_loaded) { def_load (); @@ -282,9 +283,7 @@ unsigned int getdef_unum (const char *item, unsigned int dflt) return dflt; } - if ( (str2sl(&val, d->value) == -1) - || (val < 0) - || (val > INT_MAX)) { + if (a2ui(&val, d->value, NULL, 0, 0, UINT_MAX) == -1) { fprintf (shadow_logfd, _("configuration error - cannot parse %s value: '%s'"), item, d->value);