[dovecot-cvs] dovecot/src/imap commands.c,1.10,1.11 imap-sort.c,1.4,1.5

cras at procontrol.fi cras at procontrol.fi
Thu May 15 23:22:24 EEST 2003


Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv28191/imap

Modified Files:
	commands.c imap-sort.c 
Log Message:
Renamed buffer_*_space() to buffer_*_space_unsafe() and added several
warnings about using them. Fixed their usage in a few places in sources
where they could have produced invalid results (no buffer overflows,
luckily).



Index: commands.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/commands.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- commands.c	14 May 2003 17:23:11 -0000	1.10
+++ commands.c	15 May 2003 19:22:22 -0000	1.11
@@ -57,11 +57,11 @@
 
 void command_register(const char *name, command_func_t *func)
 {
-	struct command *cmd;
+	struct command cmd;
 
-	cmd = buffer_append_space(cmdbuf, sizeof(*cmd));
-	cmd->name = name;
-	cmd->func = func;
+	cmd.name = name;
+	cmd.func = func;
+	buffer_append(cmdbuf, &cmd, sizeof(cmd));
 
 	cmdbuf_unsorted = TRUE;
 }

Index: imap-sort.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/imap-sort.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- imap-sort.c	1 Feb 2003 11:44:57 -0000	1.4
+++ imap-sort.c	15 May 2003 19:22:22 -0000	1.5
@@ -374,7 +374,8 @@
 	if (ctx->common_mask != 0)
 		mail_sort_check_flush(ctx, mail);
 
-	buf = buffer_append_space(ctx->sort_buffer, ctx->sort_element_size);
+	buf = buffer_append_space_unsafe(ctx->sort_buffer,
+					 ctx->sort_element_size);
 	id = ctx->id_is_uid ? mail->uid : mail->seq;
 	memcpy(buf, &id, sizeof(id)); pos = sizeof(id);
 



More information about the dovecot-cvs mailing list