Subject: kern/20517: PPP compressors table size is unknown outside of if_ppp.c
To: None <gnats-bugs@gnats.netbsd.org>
From: Iain Hibbert <plunky@rya-online.net>
List: netbsd-bugs
Date: 02/27/2003 22:30:17
>Number:         20517
>Category:       kern
>Synopsis:       PPP compressors table size is unknown outside of if_ppp.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 27 14:34:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     plunky@rya-online.net
>Release:        NetBSD 1.5.1
>Organization:
none
>Environment:
System: NetBSD galant 1.5.2 NetBSD 1.5.2 (GALANT) #12: Fri Feb 14 10:58:09 GMT 2003 plunky@galant:/usr/src/sys/arch/i386/compile/GALANT i386

(but, the patch below is for -current :)

>Description:
in src/sys/net/if_ppp.c, the compressors table is just declared with 8
entries (not really a problem), but we dont know that size outside of the
file - in order to load a compressor as a LKM, we should know the size
of the table so we dont overflow..
	
>How-To-Repeat:
just look at it, baby
>Fix:

*** if_ppp.c.orig	Thu Feb 27 22:07:50 2003
--- if_ppp.c	Thu Feb 27 22:08:17 2003
***************
*** 213,219 ****
  extern struct compressor ppp_bsd_compress;
  extern struct compressor ppp_deflate, ppp_deflate_draft;
  
! struct compressor *ppp_compressors[8] = {
  #if DO_BSD_COMPRESS && defined(PPP_BSDCOMP)
      &ppp_bsd_compress,
  #endif
--- 213,219 ----
  extern struct compressor ppp_bsd_compress;
  extern struct compressor ppp_deflate, ppp_deflate_draft;
  
! struct compressor *ppp_compressors[PPP_COMPRESSORS_MAX] = {
  #if DO_BSD_COMPRESS && defined(PPP_BSDCOMP)
      &ppp_bsd_compress,
  #endif
*** ppp-comp.h.orig	Thu Feb 27 22:07:58 2003
--- ppp-comp.h	Thu Feb 27 22:09:54 2003
***************
*** 52,57 ****
--- 52,64 ----
  #define DO_PREDICTOR_2	0
  
  /*
+  * How many entries to make available in the compressors table
+  */
+ #ifndef PPP_COMPRESSORS_MAX
+ #define PPP_COMPRESSORS_MAX	8
+ #endif
+ 
+ /*
   * Structure giving methods for compression/decompression.
   */
  #ifdef PACKETPTR
>Release-Note:
>Audit-Trail:
>Unformatted: