summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwalter harms <wharms@bfs.de>2014-06-04 17:12:31 +0200
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-06 17:05:58 -0700
commit7d452fad5068ba92b964e92bc46708046f4044aa (patch)
tree437d6bf1a86279c9aa913478861192e9ef7d5f47 /src
parenta3808f51517a720e7ff738208af60865779dd6ef (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/xlibi18n/lcUTF8.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/xlibi18n/lcUTF8.c b/src/xlibi18n/lcUTF8.c
index 0f3d0d2c..38201573 100644
--- a/src/xlibi18n/lcUTF8.c
+++ b/src/xlibi18n/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) {