Fixed bug #27079 (Yet another leak in PPP): outpacket_buf can be statically allocated (like in ucip)

This commit is contained in:
goldsimon 2009-12-06 11:12:18 +00:00
parent 1b42286bda
commit b1ad36eece
3 changed files with 8 additions and 15 deletions

View File

@ -46,6 +46,10 @@ HISTORY
++ Bugfixes:
2009-12-06: Simon Goldschmidt
* ppp.h/.c: Fixed bug #27079 (Yet another leak in PPP): outpacket_buf can
be statically allocated (like in ucip)
2009-12-04: Simon Goldschmidt (patch by Ioardan Neshev)
* pap.c: patch #6969: PPP: missing PAP authentication UNTIMEOUT

View File

@ -235,7 +235,7 @@ struct protent *ppp_protocols[] = {
* Buffers for outgoing packets. This must be accessed only from the appropriate
* PPP task so that it doesn't need to be protected to avoid collisions.
*/
u_char *outpacket_buf[NUM_PPP];
u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN];
/*****************************/
@ -379,7 +379,7 @@ pppHupCB(void *arg)
struct ppp_settings ppp_settings;
err_t
void
pppInit(void)
{
struct protent *protp;
@ -396,15 +396,6 @@ pppInit(void)
for (i = 0; i < NUM_PPP; i++) {
pppControl[i].openFlag = 0;
outpacket_buf[i] = (u_char *)mem_malloc(PPP_MRU+PPP_HDRLEN);
if (!outpacket_buf[i]) {
for (j = 0; j < i; j++) {
/* deallocate all preceding buffers */
mem_free(outpacket_buf[j]);
}
return ERR_MEM;
}
/*
* Initialize to the standard option set.
*/
@ -416,8 +407,6 @@ pppInit(void)
#if PPPOE_SUPPORT
pppoe_init();
#endif /* PPPOE_SUPPORT */
return ERR_OK;
}
void

View File

@ -333,7 +333,7 @@ struct ppp_addrs {
*****************************/
/* Buffers for outgoing packets. */
extern u_char *outpacket_buf[NUM_PPP];
extern u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN];
extern struct ppp_settings ppp_settings;
@ -345,7 +345,7 @@ extern struct protent *ppp_protocols[]; /* Table of pointers to supported protoc
***********************/
/* Initialize the PPP subsystem. */
err_t pppInit(void);
void pppInit(void);
/* Warning: Using PPPAUTHTYPE_ANY might have security consequences.
* RFC 1994 says: