Re: [PATCH] net/ceph/osdmap.c: fix undefined behavior when using snprintf()

2013-01-23 Thread Alex Elder
On 01/23/2013 11:41 AM, Cong Ding wrote: > On Wed, Jan 23, 2013 at 10:48:07AM -0600, Alex Elder wrote: >> On 01/22/2013 01:20 PM, Cong Ding wrote: >>> The variable "str" is used as both the source and destination in function >>> snprintf(), which is undefined behavior based on C11. The original >>

Re: [PATCH] net/ceph/osdmap.c: fix undefined behavior when using snprintf()

2013-01-23 Thread Cong Ding
On Wed, Jan 23, 2013 at 10:48:07AM -0600, Alex Elder wrote: > On 01/22/2013 01:20 PM, Cong Ding wrote: > > The variable "str" is used as both the source and destination in function > > snprintf(), which is undefined behavior based on C11. The original > > description > > in C11 is: > > "If cop

Re: [PATCH] net/ceph/osdmap.c: fix undefined behavior when using snprintf()

2013-01-23 Thread Alex Elder
On 01/22/2013 01:20 PM, Cong Ding wrote: > The variable "str" is used as both the source and destination in function > snprintf(), which is undefined behavior based on C11. The original description > in C11 is: > "If copying takes place between objects that > overlap, the behavior is un

[PATCH] net/ceph/osdmap.c: fix undefined behavior when using snprintf()

2013-01-22 Thread Cong Ding
The variable "str" is used as both the source and destination in function snprintf(), which is undefined behavior based on C11. The original description in C11 is: "If copying takes place between objects that overlap, the behavior is undefined." And, the function of ceph_osdmap_sta