Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Bugs in set_buffer?



This has been there a long time, but is it right? 

  /**/
  static void
  set_buffer(Param pm, char *x)
  {
      if(x) {
	  unmetafy(x, &ll);
	  sizeline(ll);
	  strcpy((char *)line, x);
	  zsfree(x);
	  if(cs > ll)
	      cs = ll;
      } else
	  cs = ll = 0;
      fixsuffix();
      menucmp = 0;
  }

If the unmetafy() had any effect, then x may (i) contain a NULL, so the
strcpy() should be a memcpy() (this is exactly why we need ll at all),
(ii) be a different length from the one supplied, so zsfree() isn't good
enough to free it properly.

Have I missed something?

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author