* Aprove: M_ZERO cyg_net_malloc flag
@ 2003-04-29 7:51 Andrew Lunn
2003-04-29 13:32 ` Gary Thomas
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Lunn @ 2003-04-29 7:51 UTC (permalink / raw)
To: eCos Maintainers
Aprovel request for the 2.0 branch:
Name: M_ZERO flag for cyg_net_malloc()
Purpose: The bsd_tcpip MALLOC macro can pass the flag
M_ZERO. cyg_net_malloc ignores this so leaving random junk in the
memory returned. This can then cause calls like getpeername and
getsockname to return sockaddr with junk in there tails. When such a
sockaddr is then passed back into the stack with a bind call, the bind
fails because of the junk.
Risk: Small.
Affected packages: bsd_tcpip and anything depending on it.
Andrew
Index: packages/net/bsd_tcpip//current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/bsd_tcpip/current/ChangeLog,v
retrieving revision 1.17.2.1
diff -u -r1.17.2.1 ChangeLog
--- packages/net/bsd_tcpip//current/ChangeLog 14 Mar 2003 13:44:37 -0000 1.17.2.1
+++ packages/net/bsd_tcpip//current/ChangeLog 29 Apr 2003 07:46:10 -0000
@@ -1,3 +1,8 @@
+2003-04-29 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * src/ecos/support.c (cyg_net_malloc): Honour the M_ZERO
+ flag. Otherwise we get random junk in places we don't want it.
+
2003-03-14 Andrew Lunn <andrew.lunn@ascom.ch>
* src/sys/net/if.c (if_attach): Removed printf which causes the
Index: packages/net/bsd_tcpip//current/src/ecos/support.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/bsd_tcpip/current/src/ecos/support.c,v
retrieving revision 1.4
diff -u -r1.4 support.c
--- packages/net/bsd_tcpip//current/src/ecos/support.c 3 Dec 2002 17:22:46 -0000 1.4
+++ packages/net/bsd_tcpip//current/src/ecos/support.c 29 Apr 2003 07:46:11 -0000
@@ -201,6 +201,9 @@
} else {
res = cyg_mempool_var_alloc(net_mem, size);
}
+ if ((flags & M_ZERO) && res) {
+ memset(res,0,size);
+ }
FINISH_STATS(stats_malloc);
log(LOG_MDEBUG, "%p\n", res);
return (res);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Aprove: M_ZERO cyg_net_malloc flag
2003-04-29 7:51 Aprove: M_ZERO cyg_net_malloc flag Andrew Lunn
@ 2003-04-29 13:32 ` Gary Thomas
0 siblings, 0 replies; 2+ messages in thread
From: Gary Thomas @ 2003-04-29 13:32 UTC (permalink / raw)
To: Andrew Lunn; +Cc: eCos Maintainers
On Tue, 2003-04-29 at 01:51, Andrew Lunn wrote:
> Aprovel request for the 2.0 branch:
>
> Name: M_ZERO flag for cyg_net_malloc()
>
> Purpose: The bsd_tcpip MALLOC macro can pass the flag
> M_ZERO. cyg_net_malloc ignores this so leaving random junk in the
> memory returned. This can then cause calls like getpeername and
> getsockname to return sockaddr with junk in there tails. When such a
> sockaddr is then passed back into the stack with a bind call, the bind
> fails because of the junk.
>
> Risk: Small.
>
> Affected packages: bsd_tcpip and anything depending on it.
>
Looks fine to me. Please go ahead and apply this change.
> Andrew
>
> Index: packages/net/bsd_tcpip//current/ChangeLog
> ===================================================================
> RCS file: /cvs/ecos/ecos-opt/net/net/bsd_tcpip/current/ChangeLog,v
> retrieving revision 1.17.2.1
> diff -u -r1.17.2.1 ChangeLog
> --- packages/net/bsd_tcpip//current/ChangeLog 14 Mar 2003 13:44:37 -0000 1.17.2.1
> +++ packages/net/bsd_tcpip//current/ChangeLog 29 Apr 2003 07:46:10 -0000
> @@ -1,3 +1,8 @@
> +2003-04-29 Andrew Lunn <andrew.lunn@ascom.ch>
> +
> + * src/ecos/support.c (cyg_net_malloc): Honour the M_ZERO
> + flag. Otherwise we get random junk in places we don't want it.
> +
> 2003-03-14 Andrew Lunn <andrew.lunn@ascom.ch>
>
> * src/sys/net/if.c (if_attach): Removed printf which causes the
> Index: packages/net/bsd_tcpip//current/src/ecos/support.c
> ===================================================================
> RCS file: /cvs/ecos/ecos-opt/net/net/bsd_tcpip/current/src/ecos/support.c,v
> retrieving revision 1.4
> diff -u -r1.4 support.c
> --- packages/net/bsd_tcpip//current/src/ecos/support.c 3 Dec 2002 17:22:46 -0000 1.4
> +++ packages/net/bsd_tcpip//current/src/ecos/support.c 29 Apr 2003 07:46:11 -0000
> @@ -201,6 +201,9 @@
> } else {
> res = cyg_mempool_var_alloc(net_mem, size);
> }
> + if ((flags & M_ZERO) && res) {
> + memset(res,0,size);
> + }
> FINISH_STATS(stats_malloc);
> log(LOG_MDEBUG, "%p\n", res);
> return (res);
--
------------------------------------------------------------
Gary Thomas |
MLB Associates | Consulting for the
+1 (970) 229-1963 | Embedded world
http://www.mlbassoc.com/ |
email: <gary@mlbassoc.com> |
gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-04-29 13:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-29 7:51 Aprove: M_ZERO cyg_net_malloc flag Andrew Lunn
2003-04-29 13:32 ` Gary Thomas
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).