ng_bridge(4) has an easily exploitable memory leak

Julian Elischer julian at elischer.org
Thu Apr 8 12:16:22 PDT 2004


Ruslan,
B
IGNORE THE PREVIOUS EMAIL

I was looking at how the macro expanded in -current, not in -stable..


[...]
> 
> 
> I leave it up to you to decide which you prefer, (but remember that
> NG_SEND_DATA is a macro and expads somewhat.
> 
> specifically, to (sorry about linewrap):
> #define NG_SEND_DATA(error, hook, m, meta)    \
>         do {\
>                 item_p _item;                 \
>                 if ((_item = ng_package_data((m), (meta)))) {\
>                         NG_FWD_ITEM_HOOK(error, _item, hook);    \
>                 } else { \
>                         (error) = ENOMEM;     \   
>                 }\   
>                 (m) = NULL;   \
>                 (meta) = NULL;      \
>         } while (0)
> 
> where NG_FWD_ITEM_HOOK
> itself expands to:
> #define NG_FWD_ITEM_HOOK(error, item, hook)   \
>         do { \
>                 (error) = \
>                     ng_address_hook(NULL, (item), (hook), 0);   \
>                 if (error == 0) { \
> 			SAVE_LINE(item);      \
>                         (error) = ng_snd_item((item), 0);   \ 
>                 } \
>                 (item) = NULL;         \ 
>         } while (0)
>  
> so only having one of those saves a bit of code.
> 

Maybe I should listen to myself and fix -current to follow my own
advice!




More information about the freebsd-stable mailing list