qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] r5531 made x509 certs not loadable [PATCH]


From: Henrik Holst
Subject: [Qemu-devel] r5531 made x509 certs not loadable [PATCH]
Date: Wed, 12 Nov 2008 14:56:40 +0100

The patch in r5531 which replaced a bunch of strncpy with pstrcpy causes
the x509 credentials from the -vnc parameter to be one character shorter
than entered meaning that there is currently no way to enter x509
certificates...

The attached patch fixes this. Also the path[len]='\0' is unnecessary
now that pstrcpy is used. The problem was that the previous strncpy was
called correctly which the r5531 patch didn't think. And due to how the
code is a memcpy could probably be used instead...


Index: vnc.c
===================================================================
--- vnc.c       (revision 5668)
+++ vnc.c       (workingcopy)
@@ -2338,8 +2338,7 @@
                int len = end ? end-(start+1) : strlen(start+1);
                char *path = qemu_malloc(len+1);
 
-                pstrcpy(path, len, start + 1);
-               path[len] = '\0';
+                pstrcpy(path, len + 1, start + 1);
                VNC_DEBUG("Trying certificate path '%s'\n", path);
                if (vnc_set_x509_credential_dir(vs, path) < 0) {
                    fprintf(stderr, "Failed to find x509 certificates/keys in 
%s\n", path);



/Henrik Holst
Witsbits AB

Attachment: vnc.c.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]