aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwalter harms <wharms@bfs.de>2014-06-04 17:08:12 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:29 +0200
commite7528f5816a3196c9869c6028f012ae0a6b3d650 (patch)
tree1ad47cbb6b41aa0b5a480139d104c5da1034261f
parentafc7138f952ff28a27a43452d6ea8e1ae82ae8cd (diff)
downloadnx-libs-e7528f5816a3196c9869c6028f012ae0a6b3d650.tar.gz
nx-libs-e7528f5816a3196c9869c6028f012ae0a6b3d650.tar.bz2
nx-libs-e7528f5816a3196c9869c6028f012ae0a6b3d650.zip
libX11/lcGenConv.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/lcGenConv.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/nx-X11/lib/X11/lcGenConv.c b/nx-X11/lib/X11/lcGenConv.c
index 1f7c301f5..c816c25d4 100644
--- a/nx-X11/lib/X11/lcGenConv.c
+++ b/nx-X11/lib/X11/lcGenConv.c
@@ -753,7 +753,7 @@ mbstowcs_org(
CodeSet codeset = NULL;
- const char *inbufptr = *from;
+ const char *inbufptr;
wchar_t *outbufptr = (wchar_t *) *to;
int from_size = *from_left;
@@ -764,6 +764,8 @@ mbstowcs_org(
return( 0 );
}
+ inbufptr = *from;
+
while (*from_left && *to_left) {
ch = *inbufptr++;
@@ -1252,7 +1254,7 @@ ctstowcs(
CodeSet codeset = NULL;
XlcCharSet charset_tmp;
- const char *inbufptr = *from;
+ const char *inbufptr;
wchar_t *outbufptr = (wchar_t *) *to;
int from_size = *from_left;
@@ -1262,6 +1264,7 @@ ctstowcs(
_XlcResetConverter(conv);
return( 0 );
}
+ inbufptr = *from;
while (*from_left && *to_left) {
@@ -1437,7 +1440,7 @@ cstowcs(
CodeSet codeset = NULL;
XlcCharSet charset, charset_tmp;
- const char *inbufptr = *from;
+ const char *inbufptr;
wchar_t *outbufptr = (wchar_t *) *to;
int from_size = *from_left;
@@ -1445,6 +1448,8 @@ cstowcs(
return( 0 );
}
+ inbufptr = *from;
+
charset = (XlcCharSet) args[0];
while (*from_left && *to_left) {
@@ -1643,7 +1648,7 @@ mbstostr(
CodeSet codeset = NULL;
- const char *inbufptr = *from;
+ const char *inbufptr;
char *outbufptr = *to;
int from_size = *from_left;
@@ -1654,6 +1659,8 @@ mbstostr(
return( 0 );
}
+ inbufptr = *from;
+
while (*from_left && *to_left) {
ch = *inbufptr++;
@@ -1758,7 +1765,7 @@ mbtocs(
CodeSet codeset = NULL;
XlcCharSet charset = NULL;
- const char *inbufptr = *from;
+ const char *inbufptr;
char *outbufptr = *to;
int from_size = *from_left;
@@ -1769,6 +1776,8 @@ mbtocs(
return( 0 );
}
+ inbufptr = *from;
+
while (*from_left && *to_left) {
ch = *inbufptr++;