From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0GIa-0003Og-9R for qemu-devel@nongnu.org; Wed, 12 Nov 2008 09:02:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0GIY-0003O4-KC for qemu-devel@nongnu.org; Wed, 12 Nov 2008 09:02:23 -0500 Received: from [199.232.76.173] (port=50776 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0GIY-0003Nz-B3 for qemu-devel@nongnu.org; Wed, 12 Nov 2008 09:02:22 -0500 Received: from ey-out-1920.google.com ([74.125.78.149]:60557) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L0GIX-0002vI-Ro for qemu-devel@nongnu.org; Wed, 12 Nov 2008 09:02:22 -0500 Received: by ey-out-1920.google.com with SMTP id 4so173826eyk.4 for ; Wed, 12 Nov 2008 06:02:17 -0800 (PST) From: Henrik Holst Content-Type: multipart/mixed; boundary="=-bB0mOcXvU4F9D1yTCYLo" Date: Wed, 12 Nov 2008 14:56:40 +0100 Message-Id: <1226498200.6434.101.camel@henrik-desktop> Mime-Version: 1.0 Subject: [Qemu-devel] r5531 made x509 certs not loadable [PATCH] Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --=-bB0mOcXvU4F9D1yTCYLo Content-Type: text/plain Content-Transfer-Encoding: 7bit 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 --=-bB0mOcXvU4F9D1yTCYLo Content-Disposition: attachment; filename="vnc.c.diff" Content-Type: text/x-patch; name="vnc.c.diff"; charset="UTF-8" Content-Transfer-Encoding: 7bit Index: vnc.c =================================================================== --- vnc.c (revision 5668) +++ vnc.c (arbetskopia) @@ -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); --=-bB0mOcXvU4F9D1yTCYLo--