[Python-checkins] python/dist/src/Modules binascii.c,2.33.4.3,2.33.4.4

twouters@users.sourceforge.net twouters@users.sourceforge.net
Mon, 17 Mar 2003 03:34:45 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv18224/Modules

Modified Files:
      Tag: release22-maint
	binascii.c 
Log Message:

binascii_a2b_base64: Properly return an empty string if the input was all
    invalid, rather than returning a string of random garbage of the
    estimated result length. Closes SF patch #703471 by Hye-Shik Chang.

Backport from 2.3.



Index: binascii.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v
retrieving revision 2.33.4.3
retrieving revision 2.33.4.4
diff -C2 -d -r2.33.4.3 -r2.33.4.4
*** binascii.c	25 Sep 2002 10:25:14 -0000	2.33.4.3
--- binascii.c	17 Mar 2003 11:34:43 -0000	2.33.4.4
***************
*** 412,415 ****
--- 412,419 ----
  	if (bin_len > 0)
  		_PyString_Resize(&rv, bin_len);
+ 	else {
+ 		Py_DECREF(rv);
+ 		return PyString_FromString("");
+ 	}
  	return rv;
  }