qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: Eric Blake <eblake@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK).
Date: Thu, 28 Jun 2018 16:58:47 +0100	[thread overview]
Message-ID: <20180628155847.GQ3513@redhat.com> (raw)
In-Reply-To: <20180628155404.GF1455@redhat.com>

On Thu, Jun 28, 2018 at 04:54:04PM +0100, Richard W.M. Jones wrote:
> On Thu, Jun 28, 2018 at 09:42:18AM -0500, Eric Blake wrote:
> > On 06/28/2018 08:22 AM, Richard W.M. Jones wrote:
> > >+    while (fgets(line, sizeof line, fp) != NULL) {
> > >+        if (strncmp(line, username, ulen) == 0 && line[ulen] == ':') {
> > 
> > ...can't this misbehave if the user accidentally points to some
> > other file (rather than one produced by psktool)?  I'm wondering if
> > a getline() loop would be smarter than trying to use a fixed-length
> > buffer.
> 
> I would definitely have used getline, but after examining the qemu
> source I wasn't sure if it was permitted.  It's only used in qga now.
> Is it available on Win32 for example?
> 
> Thanks for the rest of the comments.  I'll modify those where required
> in the next version.

These key files are fairly small so IMHO it would be acceptable to just
read the entire file into memory in one go using g_file_get_contents(),
and then g_str_split() on "\n"

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

  reply	other threads:[~2018-06-28 15:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 13:22 [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK) Richard W.M. Jones
2018-06-28 13:22 ` Richard W.M. Jones
2018-06-28 14:42   ` Eric Blake
2018-06-28 14:48     ` Eric Blake
2018-06-28 15:54     ` Richard W.M. Jones
2018-06-28 15:58       ` Daniel P. Berrangé [this message]
2018-06-28 16:06     ` Daniel P. Berrangé
2018-06-28 16:51       ` Richard W.M. Jones
2018-06-28 17:13         ` Daniel P. Berrangé

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=20180628155847.GQ3513@redhat.com \
    --to=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /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).