lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 6 Sep 2016 11:18:00 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Hangbin Liu' <liuhangbin@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:     Phil Sutter <phil@....cc>,
        Stephen Hemminger <stephen@...workplumber.org>
Subject: RE: [PATCH iproute2] ip route: check ftell, fseek return value

From: Hangbin Liu
> Sent: 06 September 2016 07:40
> ftell() may return -1 in error case, which is not handled and therefore pass a
> negative offset to fseek(). The return code of fseek() is also not checked.
> 
> Reported-by: Phil Sutter <phil@....cc>
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> ---
>  ip/iproute.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/ip/iproute.c b/ip/iproute.c
> index 3da23af..ba877dc 100644
> --- a/ip/iproute.c
> +++ b/ip/iproute.c
> @@ -1859,7 +1859,11 @@ static int iproute_restore(void)
>  	if (route_dump_check_magic())
>  		exit(-1);
> 
> -	pos = ftell(stdin);
> +	if ((pos = ftell(stdin)) == -1) {

Don't put assignments in conditionals.

> +		perror("Failed to restore: ftell");
> +		exit(errno);

errno is not a valid argument to exit().

...

Actually WTF is this code trying to do.
stdin is very likely to be a pipe, so expecting to seek on it
seems very likely to fail.

	David



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ