summary refs log tree commit diff stats
path: root/hw/display
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-11-10 15:16:23 +0400
committerGerd Hoffmann <kraxel@redhat.com>2018-11-12 14:14:18 +0100
commit627c865d22d63aadcf2909fe0476768bcdeef65c (patch)
tree5bf368ffad27960b0b0b06bd9dca1657f0e99ca0 /hw/display
parentc0188e69d336b5c921e026b3307e70b6ea7e9a47 (diff)
downloadfocaccia-qemu-627c865d22d63aadcf2909fe0476768bcdeef65c.tar.gz
focaccia-qemu-627c865d22d63aadcf2909fe0476768bcdeef65c.zip
edid: silence a stringop-overflow warning
Simplify the code that doesn't need strncpy() since length of string
is already computed.

/home/elmarco/src/qemu/hw/display/edid-generate.c: In function 'edid_desc_text':
/home/elmarco/src/qemu/hw/display/edid-generate.c:168:5: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
     strncpy((char *)(desc + 5), text, len);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/elmarco/src/qemu/hw/display/edid-generate.c:164:11: note: length computed here
     len = strlen(text);
           ^~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20181110111623.31356-1-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/display')
-rw-r--r--hw/display/edid-generate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index bdf5e1d4d4..77d9127344 100644
--- a/hw/display/edid-generate.c
+++ b/hw/display/edid-generate.c
@@ -165,7 +165,7 @@ static void edid_desc_text(uint8_t *desc, uint8_t type,
     if (len > 12) {
         len = 12;
     }
-    strncpy((char *)(desc + 5), text, len);
+    memcpy(desc + 5, text, len);
     desc[5 + len] = '\n';
 }