summaryrefslogtreecommitdiff
path: root/hw/dmx
diff options
context:
space:
mode:
Diffstat (limited to 'hw/dmx')
-rw-r--r--hw/dmx/config/dmxcompat.c3
-rw-r--r--hw/dmx/config/scanner.l2
-rw-r--r--hw/dmx/dmxinit.c2
3 files changed, 3 insertions, 4 deletions
diff --git a/hw/dmx/config/dmxcompat.c b/hw/dmx/config/dmxcompat.c
index b4190ffcc..98c52eb0e 100644
--- a/hw/dmx/config/dmxcompat.c
+++ b/hw/dmx/config/dmxcompat.c
@@ -94,8 +94,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/hw/dmx/config/scanner.l b/hw/dmx/config/scanner.l
index f5bb73b41..e527d6df5 100644
--- a/hw/dmx/config/scanner.l
+++ b/hw/dmx/config/scanner.l
@@ -153,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);
diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 165476c5f..b950c50a4 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -138,7 +138,7 @@ static int dmxErrorHandler(Display *dpy, XErrorEvent *ev)
for (ext = dpy->ext_procs;
ext && ext->codes.major_opcode != ev->request_code;
ext = ext->next);
- if (ext) strncpy(buf, ext->name, sizeof(buf));
+ if (ext) strlcpy(buf, ext->name, sizeof(buf));
else buf[0] = '\0';
}
dmxLog(dmxWarning, " Major opcode: %d (%s)\n",