[PATCH 3/3] libX11/lcUTF8.c fix: dereferenced before check
walter harms
wharms at bfs.de
Wed Jun 4 08:12:31 PDT 2014
* Do not use variables before checked for NULL.
Signed-off-by: Harms <wharms at bfs,de>
---
src/xlibi18n/lcUTF8.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/xlibi18n/lcUTF8.c b/src/xlibi18n/lcUTF8.c
index 0f3d0d2..bf9619d 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;
@@ -1026,6 +1026,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);
--
1.8.4.5
More information about the xorg-devel
mailing list