diff options
author | marha <marha@users.sourceforge.net> | 2011-03-04 15:38:04 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-03-04 15:38:04 +0000 |
commit | 3592ad31cfc72ffff3c9024eecea7d3b987c7954 (patch) | |
tree | 0e3b50cb6bcd0839b591d318a41d04b7cbd8e6e2 /xorg-server/xkb/ddxLoad.c | |
parent | 79409465b0b8d5d38e6b94deb1943316f40c66eb (diff) | |
parent | 0a5888393c68f6f7db86206d1f277232db18240b (diff) | |
download | vcxsrv-3592ad31cfc72ffff3c9024eecea7d3b987c7954.tar.gz vcxsrv-3592ad31cfc72ffff3c9024eecea7d3b987c7954.tar.bz2 vcxsrv-3592ad31cfc72ffff3c9024eecea7d3b987c7954.zip |
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/xkb/ddxLoad.c')
-rw-r--r-- | xorg-server/xkb/ddxLoad.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c index decad1e33..8b3dab56d 100644 --- a/xorg-server/xkb/ddxLoad.c +++ b/xorg-server/xkb/ddxLoad.c @@ -307,15 +307,16 @@ FILE * file; &&(!isalpha(xkm_output_dir[0]) || xkm_output_dir[1]!=':')
#endif
) {
- if (strlen(XkbBaseDirectory)+strlen(xkm_output_dir)
- +strlen(mapName)+6 <= PATH_MAX)
- {
- sprintf(buf,"%s/%s%s.xkm",XkbBaseDirectory,
- xkm_output_dir,mapName);
- }
+ if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory,
+ xkm_output_dir, mapName) >= PATH_MAX)
+ buf[0] = '\0';
+ }
+ else
+ {
+ if (snprintf(buf, PATH_MAX, "%s%s.xkm", xkm_output_dir, mapName)
+ >= PATH_MAX)
+ buf[0] = '\0';
}
- else if (strlen(xkm_output_dir)+strlen(mapName)+5 <= PATH_MAX)
- sprintf(buf,"%s%s.xkm",xkm_output_dir,mapName);
if (buf[0] != '\0')
file= fopen(buf,"rb");
else file= NULL;
@@ -392,11 +393,11 @@ XkbRF_RulesPtr rules; if (!rules_name)
return FALSE;
- if (strlen(XkbBaseDirectory) + strlen(rules_name) + 8 > PATH_MAX) {
+ if (snprintf(buf, PATH_MAX, "%s/rules/%s", XkbBaseDirectory, rules_name)
+ >= PATH_MAX) {
LogMessage(X_ERROR, "XKB: Rules name is too long\n");
return FALSE;
}
- sprintf(buf,"%s/rules/%s", XkbBaseDirectory, rules_name);
file = fopen(buf, "r");
if (!file) {
|