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]
Message-ID: <7vhby64i8f.fsf@alter.siamese.dyndns.org>
Date:	Tue, 23 Jun 2009 16:56:32 -0700
From:	Junio C Hamano <gitster@...ox.com>
To:	René Scharfe <rene.scharfe@...fire.ath.cx>
Cc:	roel kluin <roel.kluin@...il.com>, Ingo Molnar <mingo@...e.hu>,
	git@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Junio C Hamano <gitster@...ox.com>
Subject: Re: [PATCH] fread does not return negative on error

René Scharfe <rene.scharfe@...fire.ath.cx> writes:

> the following patch is for git.  I just removed the unneeded check for
> res == 0 from your version.  Does it look OK?

The patch looks good, and both of our in-tree users do error out when the
returned value is 0 (imap-send.c checks with "<= 0" which looks a tad
amateurish, though) correctly.

Funny, there is no caller of this function in the original context this
bug originally found, which I think is linux-2.6/tools/perf ;-).

Thanks.

> From: Roel Kluin <roel.kluin@...il.com>
>
> size_t res cannot be less than 0. fread returns 0 on error.
>
> Reported-by: Ingo Molnar <mingo@...e.hu>
> Signed-off-by: Roel Kluin <roel.kluin@...il.com>
> ---
>  strbuf.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/strbuf.c b/strbuf.c
> index a884960..f03d117 100644
> --- a/strbuf.c
> +++ b/strbuf.c
> @@ -260,7 +260,7 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)
>  	res = fread(sb->buf + sb->len, 1, size, f);
>  	if (res > 0)
>  		strbuf_setlen(sb, sb->len + res);
> -	else if (res < 0 && oldalloc == 0)
> +	else if (oldalloc == 0)
>  		strbuf_release(sb);
>  	return res;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ