Commit e7528f58 authored by walter harms's avatar walter harms Committed by Ulrich Sibiller

libX11/lcGenConv.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 afc7138f
...@@ -753,7 +753,7 @@ mbstowcs_org( ...@@ -753,7 +753,7 @@ mbstowcs_org(
CodeSet codeset = NULL; CodeSet codeset = NULL;
const char *inbufptr = *from; const char *inbufptr;
wchar_t *outbufptr = (wchar_t *) *to; wchar_t *outbufptr = (wchar_t *) *to;
int from_size = *from_left; int from_size = *from_left;
...@@ -764,6 +764,8 @@ mbstowcs_org( ...@@ -764,6 +764,8 @@ mbstowcs_org(
return( 0 ); return( 0 );
} }
inbufptr = *from;
while (*from_left && *to_left) { while (*from_left && *to_left) {
ch = *inbufptr++; ch = *inbufptr++;
...@@ -1252,7 +1254,7 @@ ctstowcs( ...@@ -1252,7 +1254,7 @@ ctstowcs(
CodeSet codeset = NULL; CodeSet codeset = NULL;
XlcCharSet charset_tmp; XlcCharSet charset_tmp;
const char *inbufptr = *from; const char *inbufptr;
wchar_t *outbufptr = (wchar_t *) *to; wchar_t *outbufptr = (wchar_t *) *to;
int from_size = *from_left; int from_size = *from_left;
...@@ -1262,6 +1264,7 @@ ctstowcs( ...@@ -1262,6 +1264,7 @@ ctstowcs(
_XlcResetConverter(conv); _XlcResetConverter(conv);
return( 0 ); return( 0 );
} }
inbufptr = *from;
while (*from_left && *to_left) { while (*from_left && *to_left) {
...@@ -1437,7 +1440,7 @@ cstowcs( ...@@ -1437,7 +1440,7 @@ cstowcs(
CodeSet codeset = NULL; CodeSet codeset = NULL;
XlcCharSet charset, charset_tmp; XlcCharSet charset, charset_tmp;
const char *inbufptr = *from; const char *inbufptr;
wchar_t *outbufptr = (wchar_t *) *to; wchar_t *outbufptr = (wchar_t *) *to;
int from_size = *from_left; int from_size = *from_left;
...@@ -1445,6 +1448,8 @@ cstowcs( ...@@ -1445,6 +1448,8 @@ cstowcs(
return( 0 ); return( 0 );
} }
inbufptr = *from;
charset = (XlcCharSet) args[0]; charset = (XlcCharSet) args[0];
while (*from_left && *to_left) { while (*from_left && *to_left) {
...@@ -1643,7 +1648,7 @@ mbstostr( ...@@ -1643,7 +1648,7 @@ mbstostr(
CodeSet codeset = NULL; CodeSet codeset = NULL;
const char *inbufptr = *from; const char *inbufptr;
char *outbufptr = *to; char *outbufptr = *to;
int from_size = *from_left; int from_size = *from_left;
...@@ -1654,6 +1659,8 @@ mbstostr( ...@@ -1654,6 +1659,8 @@ mbstostr(
return( 0 ); return( 0 );
} }
inbufptr = *from;
while (*from_left && *to_left) { while (*from_left && *to_left) {
ch = *inbufptr++; ch = *inbufptr++;
...@@ -1758,7 +1765,7 @@ mbtocs( ...@@ -1758,7 +1765,7 @@ mbtocs(
CodeSet codeset = NULL; CodeSet codeset = NULL;
XlcCharSet charset = NULL; XlcCharSet charset = NULL;
const char *inbufptr = *from; const char *inbufptr;
char *outbufptr = *to; char *outbufptr = *to;
int from_size = *from_left; int from_size = *from_left;
...@@ -1769,6 +1776,8 @@ mbtocs( ...@@ -1769,6 +1776,8 @@ mbtocs(
return( 0 ); return( 0 );
} }
inbufptr = *from;
while (*from_left && *to_left) { while (*from_left && *to_left) {
ch = *inbufptr++; ch = *inbufptr++;
......
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