aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-12-30 13:14:31 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-12-30 13:14:31 +0000
commite6d7ea3b6b52a6b77154d5b508b2555c11439580 (patch)
tree6974a5b22550aff9dc04c9d5e8f2211530791bb1 /src
parent050d52d903125b035e30ab0b1789aae56d9f40b2 (diff)
downloadrspamd-e6d7ea3b6b52a6b77154d5b508b2555c11439580.tar.gz
rspamd-e6d7ea3b6b52a6b77154d5b508b2555c11439580.zip
Do not dereference null pointer.
Diffstat (limited to 'src')
-rw-r--r--src/libmime/message.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index 8dafe75e1..94137af15 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -1130,7 +1130,7 @@ detect_text_language (struct mime_text_part *part)
gunichar c;
gint32 remain = part->content->len, max = 0, processed = 0;
gint32 scripts[G_N_ELEMENTS (language_codes)];
- GUnicodeScript scc, sel;
+ GUnicodeScript scc, sel = G_UNICODE_SCRIPT_COMMON;
p = part->content->data;
memset (scripts, 0, sizeof (scripts));
@@ -1161,8 +1161,10 @@ detect_text_language (struct mime_text_part *part)
lm = bsearch (&sel, language_codes, G_N_ELEMENTS (language_codes),
sizeof (language_codes[0]), &language_elts_cmp);
- part->lang_code = lm->code;
- part->language = lm->name;
+ if (lm != NULL) {
+ part->lang_code = lm->code;
+ part->language = lm->name;
+ }
}
}
}