summaryrefslogtreecommitdiff
path: root/Xext
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-10-28 20:19:44 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-23 12:15:05 -0800
commite189dbb3e57d30eb96034d4ce9544ce7a93a371e (patch)
treee9447d74adbffff43d916ea336c7205e052cebad /Xext
parent08093c25a91c07ab8af7cece9bba738b827cfd1b (diff)
Convert AllocXTestDevice to use asprintf
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'Xext')
-rw-r--r--Xext/xtest.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 945e202d6..b69de35f6 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -608,12 +608,11 @@ int AllocXTestDevice (ClientPtr client, char* name,
DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
{
int retval;
- int len = strlen(name);
- char *xtestname = calloc(len + 7, 1 );
+ char *xtestname;
char dummy = 1;
- strncpy( xtestname, name, len);
- strncat( xtestname, " XTEST", 6 );
+ if (asprintf(&xtestname, "%s XTEST", name) == -1)
+ return BadAlloc;
retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
if ( retval == Success ){