aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwalter harms <wharms@bfs.de>2014-06-04 17:12:31 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:29 +0200
commit191d1575f42affc0d86170132bef5a1535f7bdfa (patch)
tree34547b3d7a7d28bb8376542385496e9893376bac
parent861fe5aee1519244e4af04007076dbd814ed2b0b (diff)
downloadnx-libs-191d1575f42affc0d86170132bef5a1535f7bdfa.tar.gz
nx-libs-191d1575f42affc0d86170132bef5a1535f7bdfa.tar.bz2
nx-libs-191d1575f42affc0d86170132bef5a1535f7bdfa.zip
libX11/lcUTF8.c fix: dereferenced before check
* Do not use variables before checked for NULL. Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
-rw-r--r--nx-X11/lib/X11/lcUTF8.c4
1 files changed, 3 insertions, 1 deletions
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) {