[dovecot-cvs] dovecot/src/lib-charset charset-iconv.c, 1.17, 1.18 charset-utf8.c, 1.13, 1.14 charset-utf8.h, 1.8, 1.9

cras at dovecot.org cras at dovecot.org
Sat Jan 14 20:47:28 EET 2006


Update of /var/lib/cvs/dovecot/src/lib-charset
In directory talvi:/tmp/cvs-serv16037/lib-charset

Modified Files:
	charset-iconv.c charset-utf8.c charset-utf8.h 
Log Message:
deinit, unref, destroy, close, free, etc. functions now take a pointer to
their data pointer, and set it to NULL. This makes double-frees less likely
to cause security holes.



Index: charset-iconv.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-charset/charset-iconv.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- charset-iconv.c	13 Jan 2006 20:26:06 -0000	1.17
+++ charset-iconv.c	14 Jan 2006 18:47:24 -0000	1.18
@@ -48,8 +48,12 @@
 	return t;
 }
 
-void charset_to_utf8_end(struct charset_translation *t)
+void charset_to_utf8_end(struct charset_translation **_t)
 {
+	struct charset_translation *t = *_t;
+
+	*_t = NULL;
+
 	if (t->cd != (iconv_t)-1)
 		iconv_close(t->cd);
 	i_free(t);

Index: charset-utf8.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-charset/charset-utf8.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- charset-utf8.c	13 Jan 2006 20:26:06 -0000	1.13
+++ charset-utf8.c	14 Jan 2006 18:47:24 -0000	1.14
@@ -61,7 +61,7 @@
 	return NULL;
 }
 
-void charset_to_utf8_end(struct charset_translation *t __attr_unused__)
+void charset_to_utf8_end(struct charset_translation **t __attr_unused__)
 {
 }
 

Index: charset-utf8.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-charset/charset-utf8.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- charset-utf8.h	13 Jan 2006 20:26:06 -0000	1.8
+++ charset-utf8.h	14 Jan 2006 18:47:24 -0000	1.9
@@ -12,7 +12,7 @@
 struct charset_translation *charset_to_utf8_begin(const char *charset,
 						  bool *unknown_charset);
 
-void charset_to_utf8_end(struct charset_translation *t);
+void charset_to_utf8_end(struct charset_translation **t);
 
 void charset_to_utf8_reset(struct charset_translation *t);
 



More information about the dovecot-cvs mailing list