DragonFly BSD
DragonFly submit List (threaded) for 2005-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [PATCH] possible stack overflow in lib/libatm


From: Sepherosa Ziehau <sepherosa@xxxxxxxxx>
Date: Tue, 3 May 2005 09:27:48 +0800

OK, patch recreated (strip off guarding against NULL pointer accessing).
Please review it.

Best Regards,
sephe

On 5/2/05, Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx> wrote:
> On Mon, May 02, 2005 at 05:43:14PM +0800, Sepherosa Ziehau wrote:
> > lib/libatm
> > 1) guard against possible stack overflow
> > 2) guard against possible NULL pointer accessing
> 
> The first is ok. I'm not sure I like the others. It is common to
> let the caller guard for that, because it has to do that anyway.
> 
> Joerg
> 


-- 
Live Free or Die
Index: atm_addr.c
===================================================================
RCS file: /opt/df_cvs/src/lib/libatm/atm_addr.c,v
retrieving revision 1.3
diff -u -r1.3 atm_addr.c
--- atm_addr.c	23 Sep 2004 21:39:08 -0000	1.3
+++ atm_addr.c	2 May 2005 09:43:44 -0000
@@ -177,6 +177,8 @@
 			 */
 			val = val << 4;
 			val += c_value;
+			if (out_len >= len)
+				return 0;
 			out[out_len] = (u_char) val;
 			out_len++;
 			break;


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]