Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
---
 Xext/xtest.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 945e202..b69de35 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 ){
-- 
1.7.3.2

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to