Opened 11 years ago
Closed 11 years ago
#519 closed defect (fixed)
defect in ngx_mail_send function
Reported by: | Zerray Zhou | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-module | Version: | 1.4.x |
Keywords: | Cc: | ||
uname -a: | |||
nginx -V: |
nginx version: nginx/1.4.5
built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) |
Description
mail/ngx_mail_handler.c:561
561 if (n > 0) { 562 s->out.len -= n; 563 564 if (wev->timer_set) { 565 ngx_del_timer(wev); 566 } 567 568 if (s->quit) { 569 ngx_mail_close_connection(c); 570 return; 571 } 572 573 if (s->blocked) { 574 c->read->handler(c->read); 575 } 576 577 return; 578 }
the return statement in line 577, cause no more ngx_handle_write_event follow, so when n > 0 and n != s->out.len, it will wait for send forever
also for line 562, there should be followed by s->out.data += n, otherwise the data sent will be incorrect
Note:
See TracTickets
for help on using tickets.
Thank you for report. While it's highly unlikely that this bug will be triggered as the ngx_mail_send() function is to send very short strings, it's certainly worth fixing. Here is a patch: