Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#379 closed defect (invalid)

the bug of the function ngx_cpystrn() in the file of ngx_string.c

Reported by: Wei Wang Owned by:
Priority: major Milestone: 1.5
Component: nginx-core Version: 1.3.x
Keywords: ngx_cpystrn Cc:
uname -a: SMP Wed Jun 23 14:47:10 CST 2010 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.3.11
built by gcc 3.4.5 20051201 (Red Hat 3.4.5-2)

Description

The function ngx_cpystrn(u_char *dst, u_char *src, n) is to copy n characters from src to dst.
But it does not copy the last character because of the statement while (--n){}.
If n=1, then --n=0, and then the while loop does not execute, and then the last character of n does not copy to the dst.

Change History (2)

comment:1 by Maxim Dounin, 11 years ago

Resolution: invalid
Status: newclosed

The ngx_cpystrn() functions is to copy null-terminated string from src to dst, assuming dst points to a buffer of size n.

comment:2 by Wei Wang, 11 years ago

I see. Thank you!!!

Note: See TracTickets for help on using tickets.