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. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html