From e52799d5ce5189387a90b9d44f421ae90d00175c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 25 Oct 2016 23:40:13 +0200 Subject: Keyboard.c: replace malloc/strcpy by str(n)dup --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 3dd8b0668..1529cd359 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -900,16 +900,10 @@ XkbError: } free_model = 1; - model = malloc(i + 1); - - strncpy(model, nxagentKeyboard, i); - - model[i] = '\0'; + model = strndup(nxagentKeyboard, i); free_layout = 1; - layout = malloc(strlen(&nxagentKeyboard[i + 1]) + 1); - - strcpy(layout, &nxagentKeyboard[i + 1]); + layout = strdup(&nxagentKeyboard[i + 1]); /* * There is no description for pc105 on Solaris. -- cgit v1.2.3