qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] r5531 made x509 certs not loadable [PATCH]
@ 2008-11-14 14:39 Henrik Holst
  0 siblings, 0 replies; 3+ messages in thread
From: Henrik Holst @ 2008-11-14 14:39 UTC (permalink / raw)
  To: qemu-devel

>2008/11/12 Henrik Holst <address@hidden>:
>> 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...
>
>Thanks for spotting.  I made it a qemu_strndup instead because that's
>basically what's being implemented here (to be exact it could be a
>memdup() here because the length is already known).  Please test.
>
>Cheers

Works like a charm!

/Henrik Holst
Witsbits AB

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [Qemu-devel] r5531 made x509 certs not loadable [PATCH]
@ 2008-11-12 13:56 Henrik Holst
  2008-11-12 16:53 ` andrzej zaborowski
  0 siblings, 1 reply; 3+ messages in thread
From: Henrik Holst @ 2008-11-12 13:56 UTC (permalink / raw)
  To: qemu-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-14 14:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-14 14:39 [Qemu-devel] r5531 made x509 certs not loadable [PATCH] Henrik Holst
  -- strict thread matches above, loose matches on Subject: below --
2008-11-12 13:56 Henrik Holst
2008-11-12 16:53 ` andrzej zaborowski

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