bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] [PATCH v2] wget: Add --use-askpass support


From: Ángel González
Subject: Re: [Bug-wget] [PATCH v2] wget: Add --use-askpass support
Date: Thu, 28 Jul 2016 00:36:26 +0200
User-agent: Thunderbird

On 27/07/16 16:15, Liam R. Howlett wrote:
There are a few spots that require C99 (char * const argv, unsigned int
bytes), but I'm unsure if we ending up dropping C90 support or not.
I'd be happy to do this - however I need help doing so.  The issue is
that changing char * question to a const causes compile issues with the
char * const argv[] discarding the const qualifier.  argv must be of
this type for the call to posix_spawn.  The only way I've found to be
C99 and avoid compile issues is to pass char **question, but then it's
being passed in so that it can be edited only to avoid complaints on
compile and for C99 which seems less than ideal.

I was just pointing out the location: the variable argv, the variable bytes…
I don't expect the conversion from char* to char * const to be problematic.
The problem was intermixing code with a variable declaration.

So, for instance on:
+ close(com[1]);
+ unsigned int bytes = read(com[0], tmp, sizeof(tmp));

you are defining bytes after calling close()

so it would need to be something like:

+    unsigned int bytes;
+    close(com[1]);
+    bytes = read(com[0], tmp, sizeof(tmp));


And now that I see it, in case read() returns -1 due to an error, it would convert to MAX_INT, then attempt to strndup() such huge value and crash. It should be a ssize_t

Regards


And no



reply via email to

[Prev in Thread] Current Thread [Next in Thread]