#include <cgraph/tokenize.h>
#include <common/htmltable.h>
#include <common/entities.h>
+#include <limits.h>
#include <math.h>
#include <gvc/gvc.h>
#include <cgraph/strcasecmp.h>
if (!p || p[0] == '\0')
return defaultValue;
char *endp;
- int rv = strtol(p, &endp, 10);
- if (p == endp)
+ long rv = strtol(p, &endp, 10);
+ if (p == endp || rv > INT_MAX)
return defaultValue; /* invalid int format */
if (rv < minimum)
return minimum;
- else return rv;
+ else return (int)rv;
}
double late_double(void *obj, attrsym_t *attr, double defaultValue,