From: Vsevolod Stakhov Date: Sun, 21 Jun 2015 21:13:18 +0000 (+0100) Subject: Feed undefined behaviour. X-Git-Tag: 0.9.8~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3156e37c0572dcd5ac14ab131b797d5e3dcd790;p=thirdparty%2Frspamd.git Feed undefined behaviour. --- diff --git a/src/libutil/map.c b/src/libutil/map.c index 3fe7495b31..adc7fbe7db 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -429,19 +429,18 @@ rspamd_map_remove_all (struct rspamd_config *cfg) gboolean rspamd_map_check_proto (const gchar *map_line, gint *res, const gchar **pos) { + g_assert (res != NULL); + g_assert (pos != NULL); + if (g_ascii_strncasecmp (map_line, "http://", - sizeof ("http://") - 1) == 0) { - if (res && pos) { - *res = MAP_PROTO_HTTP; - *pos = map_line + sizeof ("http://") - 1; - } + sizeof ("http://") - 1) == 0) { + *res = MAP_PROTO_HTTP; + *pos = map_line + sizeof ("http://") - 1; } else if (g_ascii_strncasecmp (map_line, "file://", sizeof ("file://") - - 1) == 0) { - if (res && pos) { - *res = MAP_PROTO_FILE; - *pos = map_line + sizeof ("file://") - 1; - } + 1) == 0) { + *res = MAP_PROTO_FILE; + *pos = map_line + sizeof ("file://") - 1; } else if (*map_line == '/') { /* Trivial file case */