Commit 191d1575 authored by walter harms's avatar walter harms Committed by Ulrich Sibiller

libX11/lcUTF8.c fix: dereferenced before check

* Do not use variables before checked for NULL. Signed-off-by: 's avatarHarms <wharms@bfs,de> Reviewed-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 861fe5ae
...@@ -1015,7 +1015,7 @@ ucstocs1( ...@@ -1015,7 +1015,7 @@ ucstocs1(
XPointer *args, XPointer *args,
int num_args) int num_args)
{ {
ucs4_t const *src = (ucs4_t const *) *from; ucs4_t const *src;
unsigned char *dst = (unsigned char *) *to; unsigned char *dst = (unsigned char *) *to;
int unconv_num = 0; int unconv_num = 0;
Utf8Conv *preferred_charsets = (Utf8Conv *) conv->state; Utf8Conv *preferred_charsets = (Utf8Conv *) conv->state;
...@@ -1027,6 +1027,8 @@ ucstocs1( ...@@ -1027,6 +1027,8 @@ ucstocs1(
if (from == NULL || *from == NULL) if (from == NULL || *from == NULL)
return 0; return 0;
src = (ucs4_t const *) *from;
count = charset_wctocs_exactly(preferred_charsets, &chosen_charset, count = charset_wctocs_exactly(preferred_charsets, &chosen_charset,
&chosen_side, conv, dst, *src, *to_left); &chosen_side, conv, dst, *src, *to_left);
if (count < 1) { if (count < 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment