summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/misc.c b/misc.c
index 0e4f61d..4990a74 100644
--- a/misc.c
+++ b/misc.c
@@ -383,6 +383,7 @@ ComputeKbdDefaults(XkbDescPtr xkb)
register int i, tmp, nUnknown;
KeyNameDesc *name;
KeySym *syms;
+ char tmpname[XkbKeyNameLength + 1];
if ((xkb->names == NULL) || (xkb->names->keys == NULL))
{
@@ -430,8 +431,10 @@ ComputeKbdDefaults(XkbDescPtr xkb)
ACTION2("Using <U%03d> for key %d\n",
nUnknown, i);
}
- sprintf(xkb->names->keys[i].name, "U%03d",
- nUnknown++);
+ snprintf(tmpname, sizeof(tmpname), "U%03d",
+ nUnknown++);
+ memcpy(xkb->names->keys[i].name, tmpname,
+ XkbKeyNameLength);
}
break;
}
@@ -442,7 +445,9 @@ ComputeKbdDefaults(XkbDescPtr xkb)
{
WARN1("Key %d does not match any defaults\n", i);
ACTION1("Using name <U%03d>\n", nUnknown);
- sprintf(xkb->names->keys[i].name, "U%03d", nUnknown++);
+ snprintf(tmpname, sizeof(tmpname), "U%03d", nUnknown++);
+ memcpy(xkb->names->keys[i].name, tmpname,
+ XkbKeyNameLength);
}
}
}