[dovecot-cvs] dovecot/src/lib-index/mbox mbox-index.c,1.71,1.72
cras at procontrol.fi
cras at procontrol.fi
Thu May 15 23:22:24 EEST 2003
Update of /home/cvs/dovecot/src/lib-index/mbox
In directory danu:/tmp/cvs-serv28191/lib-index/mbox
Modified Files:
mbox-index.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: mbox-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-index.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- mbox-index.c 14 May 2003 18:37:07 -0000 1.71
+++ mbox-index.c 15 May 2003 19:22:22 -0000 1.72
@@ -197,7 +197,7 @@
static void mbox_parse_imapbase(const unsigned char *value, size_t len,
struct mbox_header_context *ctx)
{
- const char **flag, *str;
+ const char *flag, *str;
char *end;
buffer_t *buf;
size_t pos, start;
@@ -223,15 +223,15 @@
/* we're at the 3rd field now, which begins the list of custom flags */
buf = buffer_create_dynamic(data_stack_pool,
- MAIL_CUSTOM_FLAGS_COUNT, MAX_CUSTOM_FLAGS);
+ MAIL_CUSTOM_FLAGS_COUNT *
+ sizeof(const char *),
+ MAX_CUSTOM_FLAGS * sizeof(const char *));
for (start = pos; ; pos++) {
if (pos == len || value[pos] == ' ' || value[pos] == '\t') {
if (start != pos) {
- flag = buffer_append_space(buf, sizeof(*flag));
- if (flag == NULL)
+ flag = t_strdup_until(value+start, value+pos);
+ if (buffer_append(buf, flag, sizeof(flag)) == 0)
break;
-
- *flag = t_strdup_until(value+start, value+pos);
}
start = pos+1;
@@ -242,9 +242,8 @@
flags = MAIL_CUSTOM_FLAGS_MASK;
count = buffer_get_used_size(buf) / sizeof(const char *);
- flag = buffer_free_without_data(buf);
ret = mail_custom_flags_fix_list(ctx->index->custom_flags, &flags,
- flag, count);
+ buffer_free_without_data(buf), count);
t_pop();
}
More information about the dovecot-cvs
mailing list