summary refs log tree commit diff stats
path: root/qemu-edid.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2021-04-27 17:08:17 +0200
committerGerd Hoffmann <kraxel@redhat.com>2021-05-10 11:41:02 +0200
commitbdbe824b7e92bd42205aa0ccb58a70c1e9cb9564 (patch)
tree1284a2df4a5d7dd178b9d2464b6eb084819be782 /qemu-edid.c
parentd90f154867ec0ec22fd719164b88716e8fd48672 (diff)
downloadfocaccia-qemu-bdbe824b7e92bd42205aa0ccb58a70c1e9cb9564.tar.gz
focaccia-qemu-bdbe824b7e92bd42205aa0ccb58a70c1e9cb9564.zip
qemu-edid: use qemu_edid_size()
So we only write out that part of the edid blob
which has been filled with data.
Also use a larger buffer for the blob.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20210427150824.638359-1-kraxel@redhat.com
Message-Id: <20210427150824.638359-2-kraxel@redhat.com>
Diffstat (limited to 'qemu-edid.c')
-rw-r--r--qemu-edid.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/qemu-edid.c b/qemu-edid.c
index 1cd6a95172..c3a9fba10d 100644
--- a/qemu-edid.c
+++ b/qemu-edid.c
@@ -41,7 +41,8 @@ static void usage(FILE *out)
 int main(int argc, char *argv[])
 {
     FILE *outfile = NULL;
-    uint8_t blob[256];
+    uint8_t blob[512];
+    size_t size;
     uint32_t dpi = 100;
     int rc;
 
@@ -119,7 +120,8 @@ int main(int argc, char *argv[])
 
     memset(blob, 0, sizeof(blob));
     qemu_edid_generate(blob, sizeof(blob), &info);
-    fwrite(blob, sizeof(blob), 1, outfile);
+    size = qemu_edid_size(blob);
+    fwrite(blob, size, 1, outfile);
     fflush(outfile);
 
     exit(0);