aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nx-X11/programs/Xserver/xkb/XKBGAlloc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/nx-X11/programs/Xserver/xkb/XKBGAlloc.c b/nx-X11/programs/Xserver/xkb/XKBGAlloc.c
index ac757232e..bfbd0c325 100644
--- a/nx-X11/programs/Xserver/xkb/XKBGAlloc.c
+++ b/nx-X11/programs/Xserver/xkb/XKBGAlloc.c
@@ -702,7 +702,8 @@ register XkbKeyAliasPtr alias;
for (i=0,alias=geom->key_aliases;i<geom->num_key_aliases;i++,alias++) {
if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) {
bzero(alias->real,XkbKeyNameLength);
- strncpy(alias->real,realStr,XkbKeyNameLength);
+ memcpy(alias->real, realStr,
+ min(XkbKeyNameLength, strlen(realStr)));
return alias;
}
}
@@ -712,8 +713,8 @@ register XkbKeyAliasPtr alias;
}
alias= &geom->key_aliases[geom->num_key_aliases];
bzero(alias,sizeof(XkbKeyAliasRec));
- strncpy(alias->alias,aliasStr,XkbKeyNameLength);
- strncpy(alias->real,realStr,XkbKeyNameLength);
+ memcpy(alias->alias, aliasStr, min(XkbKeyNameLength, strlen(aliasStr)));
+ memcpy(alias->real, realStr, min(XkbKeyNameLength, strlen(realStr)));
geom->num_key_aliases++;
return alias;
}
@@ -930,8 +931,8 @@ Bool found;
if ((row->num_keys>=row->sz_keys)&&(_XkbAllocOverlayKeys(row,1)!=Success))
return NULL;
key= &row->keys[row->num_keys];
- strncpy(key->under.name,under,XkbKeyNameLength);
- strncpy(key->over.name,over,XkbKeyNameLength);
+ memcpy(key->under.name, under, min(XkbKeyNameLength, strlen(under)));
+ memcpy(key->over.name, over, min(XkbKeyNameLength, strlen(over)));
row->num_keys++;
return key;
}