public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/arm/morello/main] Fix invalid pointer dereference in wcpcpy_chk
@ 2022-11-23 14:39 Szabolcs Nagy
  0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2022-11-23 14:39 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6349c03d42f4949ef47f8b3a1612e06d120d3c35

commit 6349c03d42f4949ef47f8b3a1612e06d120d3c35
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Jun 21 15:57:48 2022 +0100

    Fix invalid pointer dereference in wcpcpy_chk
    
    The src pointer is const and points to a different object, so accessing
    dest via src is invalid.

Diff:
---
 debug/wcpcpy_chk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/debug/wcpcpy_chk.c b/debug/wcpcpy_chk.c
index bc2be43c3e..d44fb479d0 100644
--- a/debug/wcpcpy_chk.c
+++ b/debug/wcpcpy_chk.c
@@ -28,13 +28,12 @@ __wcpcpy_chk (wchar_t *dest, const wchar_t *src, size_t destlen)
 {
   wchar_t *wcp = (wchar_t *) dest - 1;
   wint_t c;
-  const ptrdiff_t off = src - dest + 1;
 
   do
     {
       if (__glibc_unlikely (destlen-- == 0))
 	__chk_fail ();
-      c = wcp[off];
+      c = *src++;
       *++wcp = c;
     }
   while (c != L'\0');

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [glibc/arm/morello/main] Fix invalid pointer dereference in wcpcpy_chk
@ 2022-10-27 13:48 Szabolcs Nagy
  0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2022-10-27 13:48 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4c22e2fa7df607356f4e3b261277fd77f8de41aa

commit 4c22e2fa7df607356f4e3b261277fd77f8de41aa
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Jun 21 15:57:48 2022 +0100

    Fix invalid pointer dereference in wcpcpy_chk
    
    The src pointer is const and points to a different object, so accessing
    dest via src is invalid.

Diff:
---
 debug/wcpcpy_chk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/debug/wcpcpy_chk.c b/debug/wcpcpy_chk.c
index bc2be43c3e..d44fb479d0 100644
--- a/debug/wcpcpy_chk.c
+++ b/debug/wcpcpy_chk.c
@@ -28,13 +28,12 @@ __wcpcpy_chk (wchar_t *dest, const wchar_t *src, size_t destlen)
 {
   wchar_t *wcp = (wchar_t *) dest - 1;
   wint_t c;
-  const ptrdiff_t off = src - dest + 1;
 
   do
     {
       if (__glibc_unlikely (destlen-- == 0))
 	__chk_fail ();
-      c = wcp[off];
+      c = *src++;
       *++wcp = c;
     }
   while (c != L'\0');

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-23 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23 14:39 [glibc/arm/morello/main] Fix invalid pointer dereference in wcpcpy_chk Szabolcs Nagy
  -- strict thread matches above, loose matches on Subject: below --
2022-10-27 13:48 Szabolcs Nagy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).