-
- // To prevent endless aliasing loops, we will only do this five times.
- for (int alias_loop=0; alias_loop<5; ++alias_loop) {
- mailtype = expand_aliases(this_recp);
- if (mailtype == EA_MULTIPLE) {
- // If an alias expanded to multiple recipients, strip off those recipients and append them
- // to the end of the array. This loop will hit those again when it gets there.
+ // If an alias expanded to multiple recipients, strip off those recipients and append them
+ // to the end of the array. This loop will hit those again when it gets there.
+ // Note that we don't do this after we get past the *original* array length, to avoid aliasing loops.
+ if (mailtype == EA_MULTIPLE) {
+ if (r < original_array_len) {