current pcrs.c,1.51,1.52

Fabian Keil <[email protected]> Mon, 29 May 2017 10:09:39 +0000
Newsgroups gmane.comp.web.privoxy.cvs
Message-ID <[email protected]>
Update of /cvsroot/ijbswa/current
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28542

Modified Files:
	pcrs.c 
Log Message:
pcrs_compile_replacement(): Fix a clang warning when building with FUZZ support

The warning was:
"Address of stack memory associated with local variable 'length' is
still referred to by the static variable 'length_stack' upon returning
to the caller. This will be a dangling reference"

For the fuzzing use case it didn't matter but it still shouldn't be done.

While at it, remove a couple of variables that were only used
to make debugging more convenient.


Index: pcrs.c
===================================================================
RCS file: /cvsroot/ijbswa/current/pcrs.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** pcrs.c	24 Dec 2016 16:00:49 -0000	1.51
--- pcrs.c	29 May 2017 10:09:37 -0000	1.52
***************
*** 242,255 ****
  {
     int i, k, l, quoted;
-    size_t length;
     char *text;
     pcrs_substitute *r;
! #ifdef FUZZ
!    static const char *replacement_stack;
!    static const size_t *length_stack;
!    static pcrs_substitute *r_stack;
! 
!    replacement_stack = replacement;
!    length_stack = &length;
  #endif
     i = k = l = quoted = 0;
--- 242,251 ----
  {
     int i, k, l, quoted;
     char *text;
     pcrs_substitute *r;
! #ifndef FUZZ
!    size_t length;
! #else
!    static size_t length;
  #endif
     i = k = l = quoted = 0;
***************
*** 273,280 ****
     memset(r, '\0', sizeof(pcrs_substitute));
  
- #ifdef FUZZ
-    r_stack = r;
- #endif
- 
     length = strlen(replacement);
  
--- 269,272 ----


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot