qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Henrik Holst <henrik@witsbits.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] r5531 made x509 certs not loadable [PATCH]
Date: Wed, 12 Nov 2008 14:56:40 +0100	[thread overview]
Message-ID: <1226498200.6434.101.camel@henrik-desktop> (raw)

[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]

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 #2: vnc.c.diff --]
[-- Type: text/x-patch, Size: 549 bytes --]

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);

             reply	other threads:[~2008-11-12 14:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-12 13:56 Henrik Holst [this message]
2008-11-12 16:53 ` [Qemu-devel] r5531 made x509 certs not loadable [PATCH] andrzej zaborowski
  -- strict thread matches above, loose matches on Subject: below --
2008-11-14 14:39 Henrik Holst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1226498200.6434.101.camel@henrik-desktop \
    --to=henrik@witsbits.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).