[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 0/3] Use string bound functions (take #2)
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx wrote on 01/29/2007 11:07:18 AM: > On 29/1/07 14:22, "Christoph Egger" <Christoph.Egger@xxxxxxx> wrote: > > > I killed safe_strcpy() and almost all users from strcpy() and strncpy(). > > The remaining users are acm and acpi. Thanks. This would have been it -- I am sure you did the same. Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx> Index: root/xen-unstable.hg/xen/acm/acm_core.c =================================================================== --- root.orig/xen-unstable.hg/xen/acm/acm_core.c +++ root/xen-unstable.hg/xen/acm/acm_core.c @@ -89,7 +89,9 @@ acm_set_policy_reference(u8 * buf, u32 b if (!acm_bin_pol.policy_reference_name) return -ENOMEM; - strcpy(acm_bin_pol.policy_reference_name, (char *)(buf + sizeof(struct acm_policy_reference_buffer))); + strlcpy(acm_bin_pol.policy_reference_name, + (char *)(buf + sizeof(struct acm_policy_reference_buffer)), + ntohl(pr->len)); printk("%s: Activating policy %s\n", __func__, acm_bin_pol.policy_reference_name); return 0; } @@ -106,8 +108,9 @@ acm_dump_policy_reference(u8 *buf, u32 b memset(buf, 0, ret); pr_buf->len = htonl(strlen(acm_bin_pol.policy_reference_name) + 1); /* including stringend '\0' */ - strcpy((char *)(buf + sizeof(struct acm_policy_reference_buffer)), - acm_bin_pol.policy_reference_name); + strlcpy((char *)(buf + sizeof(struct acm_policy_reference_buffer)), + acm_bin_pol.policy_reference_name, + buf_size - sizeof(struct acm_policy_reference_buffer)); return ret; } > > When this is done, strcpy() and strncpy() can be removed. > > Okay, there are no live users of strcpy/strncpy/strcat/strncat (I fixed the > acm uses and the acpi uses are dead macros that aren't used). So I've killed > off those functions, #defined them to informative undefined labels, and > implemented strlcat(). > > sprintf() can go once the ia64 uses are fixed up. > > -- Keir > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxxxxxxxx > http://lists.xensource.com/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |