From 191d1575f42affc0d86170132bef5a1535f7bdfa Mon Sep 17 00:00:00 2001 From: walter harms Date: Wed, 4 Jun 2014 17:12:31 +0200 Subject: libX11/lcUTF8.c fix: dereferenced before check * Do not use variables before checked for NULL. Signed-off-by: Harms Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/lcUTF8.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nx-X11') diff --git a/nx-X11/lib/X11/lcUTF8.c b/nx-X11/lib/X11/lcUTF8.c index 0f3d0d2ca..38201573e 100644 --- a/nx-X11/lib/X11/lcUTF8.c +++ b/nx-X11/lib/X11/lcUTF8.c @@ -1015,7 +1015,7 @@ ucstocs1( XPointer *args, int num_args) { - ucs4_t const *src = (ucs4_t const *) *from; + ucs4_t const *src; unsigned char *dst = (unsigned char *) *to; int unconv_num = 0; Utf8Conv *preferred_charsets = (Utf8Conv *) conv->state; @@ -1027,6 +1027,8 @@ ucstocs1( if (from == NULL || *from == NULL) return 0; + src = (ucs4_t const *) *from; + count = charset_wctocs_exactly(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, *src, *to_left); if (count < 1) { -- cgit v1.2.3