catch underflow/overflow errors
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24836 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -88,9 +88,15 @@ check_time(krb5_context context, const char *path, char *data)
|
|||||||
static int
|
static int
|
||||||
check_numeric(krb5_context context, const char *path, char *data)
|
check_numeric(krb5_context context, const char *path, char *data)
|
||||||
{
|
{
|
||||||
long int v;
|
long v;
|
||||||
char *end;
|
char *end;
|
||||||
v = strtol(data, &end, 0);
|
v = strtol(data, &end, 0);
|
||||||
|
|
||||||
|
if ((v == LONG_MIN || v == LONG_MAX) && errno != 0) {
|
||||||
|
krb5_warnx(context, "%s: over/under flow for \"%s\"",
|
||||||
|
path, data);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if(*end != '\0') {
|
if(*end != '\0') {
|
||||||
krb5_warnx(context, "%s: failed to parse \"%s\" as a number",
|
krb5_warnx(context, "%s: failed to parse \"%s\" as a number",
|
||||||
path, data);
|
path, data);
|
||||||
|
Reference in New Issue
Block a user