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] [day] [month] [year] [list]
Date:   Fri, 3 Dec 2021 14:31:33 +0800
From:   Zhiqiang Liu <liuzhiqiang26@...wei.com>
To:     zhanchengbin <zhanchengbin1@...wei.com>,
        Theodore Ts'o <tytso@....edu>
CC:     <linux-ext4@...r.kernel.org>, <linfeilong@...wei.com>
Subject: Re: [PATCH 1/6] e2fsck: set s->len=0 if malloc() fails in
 alloc_string()

On 2021/12/3 14:26, zhanchengbin wrote:
> In alloc_string(), when malloc fails, len in the
> string structure should be 0.
>
> Signed-off-by: zhanchengbin <zhanchengbin1@...wei.com>
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@...wei.com>
> ---
>  e2fsck/logfile.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/e2fsck/logfile.c b/e2fsck/logfile.c
> index 63e9a12f..f2227ad5 100644
> --- a/e2fsck/logfile.c
> +++ b/e2fsck/logfile.c
> @@ -32,6 +32,8 @@ static void alloc_string(struct string *s, int len)
>  {
>      s->s = malloc(len);
>  /* e2fsck_allocate_memory(ctx, len, "logfile name"); */
> +    if (s->s == NULL)
> +        s->len = 0;

we should add 'else' branch here.

+    if (s->s == NULL)
+        s->len = 0;
+    else
+       s->len = len;


please correct that in the v2 patches.


>     
>      s->end = 0;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ