aboutsummaryrefslogtreecommitdiff
path: root/libX11/src/xlibi18n/XlcDL.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-08-26 10:26:21 +0200
committermarha <marha@users.sourceforge.net>2013-08-26 10:26:21 +0200
commitbe8a3ecf0bebc7134452778070cd83b7decf7f71 (patch)
treee3a5d81a99754c393062ed811bece6e0787e3767 /libX11/src/xlibi18n/XlcDL.c
parent7403278d95051a554e2cbec3fafdde8ce9c6d200 (diff)
parent5ee5b91b019005aa27273dff01388a68c12be293 (diff)
downloadvcxsrv-be8a3ecf0bebc7134452778070cd83b7decf7f71.tar.gz
vcxsrv-be8a3ecf0bebc7134452778070cd83b7decf7f71.tar.bz2
vcxsrv-be8a3ecf0bebc7134452778070cd83b7decf7f71.zip
Merge remote-tracking branch 'origin/released'
* origin/released: xserver mesa fontconfig libX11 libxcb libxcb/xcb-proto xkeyboard-config git update 26 Aug 2013
Diffstat (limited to 'libX11/src/xlibi18n/XlcDL.c')
-rw-r--r--libX11/src/xlibi18n/XlcDL.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/libX11/src/xlibi18n/XlcDL.c b/libX11/src/xlibi18n/XlcDL.c
index 75e193c05..a23603865 100644
--- a/libX11/src/xlibi18n/XlcDL.c
+++ b/libX11/src/xlibi18n/XlcDL.c
@@ -185,16 +185,10 @@ resolve_object(char *path, const char *lc_name)
if (lc_len == 0) { /* True only for the 1st time */
lc_len = OBJECT_INIT_LEN;
- xi18n_objects_list = (XI18NObjectsList)
- Xmalloc(sizeof(XI18NObjectsListRec) * lc_len);
+ xi18n_objects_list = Xmalloc(sizeof(XI18NObjectsListRec) * lc_len);
if (!xi18n_objects_list) return;
}
-/*
-1266793
-Limit the length of path to prevent stack buffer corruption.
- sprintf(filename, "%s/%s", path, "XI18N_OBJS");
-*/
- sprintf(filename, "%.*s/%s", BUFSIZ - 12, path, "XI18N_OBJS");
+ snprintf(filename, sizeof(filename), "%s/%s", path, "XI18N_OBJS");
fp = fopen(filename, "r");
if (fp == (FILE *)NULL){
return;
@@ -212,11 +206,13 @@ Limit the length of path to prevent stack buffer corruption.
}
if (lc_count == lc_len) {
- lc_len += OBJECT_INC_LEN;
- xi18n_objects_list = (XI18NObjectsList)
- Xrealloc(xi18n_objects_list,
- sizeof(XI18NObjectsListRec) * lc_len);
- if (!xi18n_objects_list) return;
+ int new_len = lc_len + OBJECT_INC_LEN;
+ XI18NObjectsListRec *tmp = Xrealloc(xi18n_objects_list,
+ sizeof(XI18NObjectsListRec) * new_len);
+ if (tmp == NULL)
+ goto done;
+ xi18n_objects_list = tmp;
+ lc_len = new_len;
}
n = parse_line(p, args, 6);
@@ -244,6 +240,7 @@ Limit the length of path to prevent stack buffer corruption.
lc_count++;
}
}
+ done:
fclose(fp);
}
@@ -383,9 +380,9 @@ _XlcDynamicLoad(const char *lc_name)
if (lc_name == NULL) return (XLCd)NULL;
- if (_XlcLocaleDirName(lc_dir, BUFSIZE, (char *)lc_name) == (char *)NULL)
+ if (_XlcLocaleDirName(lc_dir, BUFSIZE, lc_name) == NULL)
return (XLCd)NULL;
- if (_XlcLocaleLibDirName(lc_lib_dir, BUFSIZE, (char *)lc_name) == (char*)NULL)
+ if (_XlcLocaleLibDirName(lc_lib_dir, BUFSIZE, lc_name) == NULL)
return (XLCd)NULL;
resolve_object(lc_dir, lc_name);
@@ -512,7 +509,7 @@ _XDynamicUnRegisterIMInstantiateCallback(
XPointer client_data)
{
char lc_dir[BUFSIZE];
- char *lc_name;
+ const char *lc_name;
dynamicUnregisterProcp im_unregisterIM = (dynamicUnregisterProcp)NULL;
Bool ret_flag = False;
int count;