[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] hvmloader/smbios: Change strncpy to memcpy for anchor strings.
On 24/09/2013 10:39, "Jan Beulich" <JBeulich@xxxxxxxx> wrote: >>> - strncpy(ep->anchor_string, "_SM_", 4); >>> + memcpy(ep->anchor_string, "_SM_", sizeof(ep->anchor_string)); >> >> Why the change from 4 to sizeof(ep->anchor_string) here (and similar below)? >> Setting the copy length based on the size of the destination rather than the >> source seems like the wrong thing to do. > > One can argue either way here: > - passing the destination's size guarantees no memory corruption > - passing the source's size guarantees no uninitialized memory > > Since the structure fields involved here aren't going to change, > either way is fine imo. As was the unadorned number 4, imo. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |