diff options
Diffstat (limited to 'xorg-server/hw/dmx/config')
-rw-r--r-- | xorg-server/hw/dmx/config/Makefile.am | 4 | ||||
-rw-r--r-- | xorg-server/hw/dmx/config/dmxcompat.c | 4 | ||||
-rw-r--r-- | xorg-server/hw/dmx/config/scanner.l | 3 |
3 files changed, 8 insertions, 3 deletions
diff --git a/xorg-server/hw/dmx/config/Makefile.am b/xorg-server/hw/dmx/config/Makefile.am index de4ce315d..75181436e 100644 --- a/xorg-server/hw/dmx/config/Makefile.am +++ b/xorg-server/hw/dmx/config/Makefile.am @@ -22,6 +22,10 @@ MAINTAINERCLEANFILES = $(BUILT_SOURCES) libdmxconfig_a_SOURCES = $(LIBSRCS) +if NEED_STRLCAT +libdmxconfig_a_SOURCES += $(top_srcdir)/os/strlcpy.c +endif + if GLX GLX_DEFS = @GL_CFLAGS@ endif diff --git a/xorg-server/hw/dmx/config/dmxcompat.c b/xorg-server/hw/dmx/config/dmxcompat.c index b4190ffcc..1c72084fa 100644 --- a/xorg-server/hw/dmx/config/dmxcompat.c +++ b/xorg-server/hw/dmx/config/dmxcompat.c @@ -42,6 +42,7 @@ #include <dmx-config.h> #endif +#include "os.h" #include "dmxconfig.h" #include "dmxparse.h" #include "dmxcompat.h" @@ -94,8 +95,7 @@ static void dmxVDLDisplayEntry(const char *buf, char *end; pt = strchr(buf, ' '); - strncpy(name, buf, pt-buf); - name[pt-buf] = '\0'; + strlcpy(name, buf, 1+pt-buf); *len = strlen(name); *x = strtol(pt, &end, 10); diff --git a/xorg-server/hw/dmx/config/scanner.l b/xorg-server/hw/dmx/config/scanner.l index cef99d088..e527d6df5 100644 --- a/xorg-server/hw/dmx/config/scanner.l +++ b/xorg-server/hw/dmx/config/scanner.l @@ -39,6 +39,7 @@ #include "dmxparse.h" #include "parser.h" +#include "os.h" #include <string.h> #include <stdlib.h> #include <ctype.h> @@ -152,7 +153,7 @@ static int getdimension(int token, const char *text, int leng) char *tmp = dmxConfigAlloc(leng+1); int x, y; - strncpy(tmp, text, leng); + strlcpy(tmp, text, leng+1); x = strtol(tmp, &endptr, 10); while (*endptr && !isdigit(*endptr)) ++endptr; y = strtol(endptr, NULL, 10); |