summaryrefslogtreecommitdiff
path: root/hw/dmx
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2018-04-05 12:48:26 -0400
committerAdam Jackson <ajax@redhat.com>2018-04-05 14:18:44 -0400
commitd13cd3862e9ccd35c91a06680d02f2fc8fd03420 (patch)
tree05cdd5aefec148c0b7444fd50434c3cdb78dd659 /hw/dmx
parent176f26e96ab9958c84c98c88f31729d0240c420e (diff)
dmx: Silence a string truncation warning.
../hw/dmx/config/dmxparse.c: In function ‘dmxConfigCreateOption’: ../hw/dmx/config/dmxparse.c:385:13: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation] strncpy(option->string + offset, p->string, len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../hw/dmx/config/dmxparse.c:383:23: note: length computed here int len = strlen(p->string); ^~~~~~~~~~~~~~~~~ The thing it's warning about is intentional, the surrounding code does its own nul-termination. Make that obvious by using memcpy instead. Signed-off-by: Adam Jackson <ajax@redhat.com> Acked-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw/dmx')
-rw-r--r--hw/dmx/config/dmxparse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/dmx/config/dmxparse.c b/hw/dmx/config/dmxparse.c
index cf510844d..f66143a6a 100644
--- a/hw/dmx/config/dmxparse.c
+++ b/hw/dmx/config/dmxparse.c
@@ -382,7 +382,7 @@ dmxConfigCreateOption(DMXConfigTokenPtr pStart,
if (p->string) {
int len = strlen(p->string);
- strncpy(option->string + offset, p->string, len);
+ memcpy(option->string + offset, p->string, len);
offset += len;
if (p->next)
option->string[offset++] = ' ';