From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id EACB7385840F; Tue, 29 Aug 2023 12:34:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EACB7385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693312455; bh=rMDdhe/WnQHUVo5F4bFvZb5qPtSKMrYCpLycIDRBsck=; h=From:To:Subject:Date:From; b=cry0ercKfStUJA5MEkxoBgosuU34/y0LuNFR1U6Us2musD+cgrFF7oAvTm71Vy+TS 3SZSdjLI2yIukQcGBpwGBQ4UuAtKQ8KoGbNkPE6lOhiLAjWJpmTAbglC4pcLOIJj7V FI7NVAGzipB4ogQe+ujP90PXijYmO/ZXUGo2MPkM= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin/main] libc/stdlib/nano-mallocr.c, typo in variable name X-Act-Checkin: newlib-cygwin X-Git-Author: =?utf-8?q?Pekka_Sepp=C3=A4nen?= X-Git-Refname: refs/heads/main X-Git-Oldrev: ca2a4ec243627b19f0ac2c7262703f81712f3be4 X-Git-Newrev: 31eb43efa78f8bb67216eec1e7aa0be530360881 Message-Id: <20230829123415.EACB7385840F@sourceware.org> Date: Tue, 29 Aug 2023 12:34:15 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D31eb43efa78= f8bb67216eec1e7aa0be530360881 commit 31eb43efa78f8bb67216eec1e7aa0be530360881 Author: Pekka Sepp=C3=A4nen AuthorDate: Mon Aug 28 14:02:20 2023 +0300 Commit: Corinna Vinschen CommitDate: Tue Aug 29 14:33:27 2023 +0200 libc/stdlib/nano-mallocr.c, typo in variable name =20 Nano malloc uses `size' in assertation whereas the correct variable wou= ld be `s'. Given this has existed ever since nano malloc support was added, = based on the context ("returned payload area of desired size does not exceed = the actual allocated chunk") I presume that indeed `s' (user input) and not `r->size' (computed) shall be used. Diff: --- newlib/libc/stdlib/nano-mallocr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-ma= llocr.c index a2b50facc35e..41e69abb0bc8 100644 --- a/newlib/libc/stdlib/nano-mallocr.c +++ b/newlib/libc/stdlib/nano-mallocr.c @@ -396,7 +396,7 @@ void * nano_malloc(RARG malloc_size_t s) *(long *)((char *)r + offset) =3D -offset; } =20 - assert(align_ptr + size <=3D (char *)r + alloc_size); + assert(align_ptr + s <=3D (char *)r + alloc_size); return align_ptr; } #endif /* DEFINE_MALLOC */