Hi,

I just took a look into the dovecot 2.1 sources and just saw a possible issue 
in array.h.

This code snippet as an example:
#static inline void *
#array_get_modifiable_i(struct array *array, unsigned int *count_r)
#{
#       *count_r = array->buffer->used / array->element_size;
#       return buffer_get_modifiable_data(array->buffer, NULL);
#}

array->buffer->used and array->element_size are of type 'size_t' which is 
64bit on amd64 and others while 'count_r' is a 32bit value. At least, I see 
ugly warnings with -Wconversion (which I personally like to use).

I know, it is unlikely that 'array->buffer->used / array->element_size' 
exceeds 32bit range. But then, dovecot's source is so well written, that the 
above code seems to disturb dovecot's code aesthetics.

And who knows... in a few years (when we have THz and TBytes on our desktops) 
emails (and array sizes) might exceed everything that we think of today.

Tim

Reply via email to