From 9a6b90c316e6ad2a5180ee9be4b0c9c7139d86b7 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 8 Dec 2017 00:30:32 +0100 Subject: Font.c: make nxagentGetFontServerPath more readable --- nx-X11/programs/Xserver/hw/nxagent/Font.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index 0a9f6e3c3..39c3b31e1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -1411,11 +1411,12 @@ static Bool nxagentGetFontServerPath(char * fontServerPath) if (NXGetFontParameters(nxagentDisplay, sizeof(path), path) == True) { - if (*path != '\0') - { - strncpy(fontServerPath, path + 1, *path); + unsigned int len = *path; - fontServerPath[*path] = '\0'; + if (len) + { + strncpy(fontServerPath, path + 1, len); + fontServerPath[len] = '\0'; #ifdef TEST fprintf(stderr, "nxagentGetFontServerPath: Got path [%s].\n", -- cgit v1.2.3