}
if (slash) {
- mask = strtoul (slash + 1, NULL, 10);
+ gchar *end = NULL;
+
+ mask = strtoul (slash + 1, &end, 10);
if (mask > 32) {
msg_info_spf ("invalid mask for ip4 element for %s: %s", addr->spf_string,
rec->sender_domain);
return FALSE;
}
+ if (end != NULL && !g_ascii_isspace(*end) && *end != '\0') {
+ /* Invalid mask definition */
+ msg_info_spf ("invalid mask for ip4 element for %s: %s", addr->spf_string,
+ rec->sender_domain);
+ return FALSE;
+ }
+
addr->m.dual.mask_v4 = mask;
if (mask < min_valid_mask) {
}
if (slash) {
- mask = strtoul (slash + 1, NULL, 10);
+ gchar *end = NULL;
+ mask = strtoul (slash + 1, &end, 10);
if (mask > 128) {
msg_info_spf ("invalid mask for ip6 element for %s: %s", addr->spf_string,
rec->sender_domain);
return FALSE;
}
+ if (end != NULL && !g_ascii_isspace(*end) && *end != '\0') {
+ /* Invalid mask definition */
+ msg_info_spf ("invalid mask for ip4 element for %s: %s", addr->spf_string,
+ rec->sender_domain);
+ return FALSE;
+ }
+
addr->m.dual.mask_v6 = mask;
if (mask < min_valid_mask) {
{
const gchar *p, *macro_value = NULL;
gchar *c, *new, *tmp, delim = '.';
- gsize len = 0, slen = 0, macro_len = 0;
+ gsize len = 0, macro_len = 0;
gint state = 0, ndelim = 0;
gchar ip_buf[64 + 1]; /* cannot use INET6_ADDRSTRLEN as we use ptr lookup */
gboolean need_expand = FALSE, reversed;
len++;
}
- slen++;
p++;
break;
case 1:
return begin;
}
p++;
- slen++;
+
break;
case 2:
/* Read macro name */
return begin;
}
p++;
- slen++;
state = 3;
break;
case 3:
need_expand = TRUE;
}
p++;
- slen++;
break;
default: