[pok-devel] [19] * Make sure that we don't clean more than expected, leading

[ Thread Index | Date Index | More lists.tuxfamily.org/pok-devel Archives ]


Revision: 19
Author:   julien
Date:     2011-08-28 08:50:48 +0200 (Sun, 28 Aug 2011)
Log Message:
-----------
 * Make sure that we don't clean more than expected, leading
   to clean other partitions memory space.

Modified Paths:
--------------
    trunk/kernel/middleware/portqueueingreceive.c

Modified: trunk/kernel/middleware/portqueueingreceive.c
===================================================================
--- trunk/kernel/middleware/portqueueingreceive.c	2011-08-27 22:16:06 UTC (rev 18)
+++ trunk/kernel/middleware/portqueueingreceive.c	2011-08-28 06:50:48 UTC (rev 19)
@@ -39,13 +39,12 @@
 
    pok_port_size_t   clen;
    pok_port_size_t   rlen;
+   pok_port_size_t   toclean;
    pok_ret_t ret;
 
    pok_lockobj_lockattr_t lockattr;
    (void) lockattr;
 
-   memset (data, '\0', maxlen);
-
    *len = 0;
    if (maxlen <= 0)
    {
@@ -78,6 +77,15 @@
       return POK_ERRNO_DIRECTION;
    }
 
+   toclean = maxlen;
+   if (toclean > pok_ports[id].size)
+   {
+      toclean =  pok_ports[id].size;
+   }
+
+   /* Make sure we clean the data buffer before */
+   memset (data, '\0', toclean);
+
    /*
     * TODO : check that the partition has the right
     * to receive anything


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/