[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-list
Subject:    Re: [LTP] [PATCH] Fix access out of bounds in dup204.c.
From:       Garrett Cooper <yanegomi () gmail ! com>
Date:       2011-01-21 17:36:02
Message-ID: AANLkTinADcBWpV8UADG0kaY1Wvjngc2hgbs3Yc7usH+Y () mail ! gmail ! com
[Download RAW message or body]

On Fri, Jan 21, 2011 at 4:39 AM, Cristian Greco <cristian@regolo.cc> wrote:
> Hi,
>
> this should fix an access out-of-bounds.

This was the proper solution. Thanks for spotting the issue!
-Garrett

diff --git a/testcases/kernel/syscalls/dup2/dup204.c
b/testcases/kernel/syscalls/dup2/dup204.c
index fd20ece..5b33484 100644
--- a/testcases/kernel/syscalls/dup2/dup204.c
+++ b/testcases/kernel/syscalls/dup2/dup204.c
@@ -132,10 +132,10 @@ void cleanup()

        TEST_CLEANUP;

-       for (i = 0; i < sizeof(fd); i++) {
+       for (i = 0; i < (sizeof(fd) / sizeof(fd[0])); i++) {
                close(fd[i]);
                close(nfd[i]);
        }

        tst_rmdir();
-}
\ No newline at end of file
+}

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic