[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK).
From: |
Daniel P . Berrangé |
Subject: |
Re: [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK). |
Date: |
Thu, 28 Jun 2018 16:58:47 +0100 |
User-agent: |
Mutt/1.10.0 (2018-05-17) |
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 :|
- [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK)., Richard W.M. Jones, 2018/06/28
- [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK)., Richard W.M. Jones, 2018/06/28
- Re: [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK)., Eric Blake, 2018/06/28
- Re: [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK)., Eric Blake, 2018/06/28
- Re: [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK)., Richard W.M. Jones, 2018/06/28
- Re: [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK).,
Daniel P . Berrangé <=
- Re: [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK)., Daniel P . Berrangé, 2018/06/28
- Re: [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK)., Richard W.M. Jones, 2018/06/28
- Re: [Qemu-devel] [PATCH v3] crypto: Implement TLS Pre-Shared Keys (PSK)., Daniel P . Berrangé, 2018/06/28