diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-06-12 15:41:15 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-06-12 15:41:15 +0100 |
commit | 461990971f96763861501483b0316fb13b670fa4 (patch) | |
tree | fc40bc1aa8c67a4a3e1c7bfef3b75f2a4559c339 /tools/vnet | |
parent | 697376dd738b51c7046e00267a1844e0d02bbf62 (diff) | |
download | xen-461990971f96763861501483b0316fb13b670fa4.tar.gz xen-461990971f96763861501483b0316fb13b670fa4.tar.bz2 xen-461990971f96763861501483b0316fb13b670fa4.zip |
tools: replace sprintf with snprintf where applicable
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Diffstat (limited to 'tools/vnet')
-rw-r--r-- | tools/vnet/vnet-module/varp_util.h | 6 | ||||
-rw-r--r-- | tools/vnet/vnet-module/vnet.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tools/vnet/vnet-module/varp_util.h b/tools/vnet/vnet-module/varp_util.h index d461029088..2f671b3b6b 100644 --- a/tools/vnet/vnet-module/varp_util.h +++ b/tools/vnet/vnet-module/varp_util.h @@ -53,11 +53,11 @@ static inline const char *VarpAddr_ntoa(VarpAddr *addr, char buf[VARP_ADDR_BUF]) switch(addr->family){ default: case AF_INET: - sprintf(buf, "%u.%u.%u.%u", + snprintf(buf, sizeof(buf), "%u.%u.%u.%u", NIPQUAD(addr->u.ip4)); break; case AF_INET6: - sprintf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x", + snprintf(buf, sizeof(buf), "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x", NIP6(addr->u.ip6)); break; } @@ -66,7 +66,7 @@ static inline const char *VarpAddr_ntoa(VarpAddr *addr, char buf[VARP_ADDR_BUF]) static inline const char *VnetId_ntoa(VnetId *vnet, char buf[VNET_ID_BUF]) { - sprintf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x", + snprintf(buf, sizeof(buf), "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x", ntohs(vnet->u.vnet16[0]), \ ntohs(vnet->u.vnet16[1]), \ ntohs(vnet->u.vnet16[2]), \ diff --git a/tools/vnet/vnet-module/vnet.c b/tools/vnet/vnet-module/vnet.c index 51796415cc..b213292a15 100644 --- a/tools/vnet/vnet-module/vnet.c +++ b/tools/vnet/vnet-module/vnet.c @@ -354,7 +354,7 @@ static int vnet_setup(void){ if(err) break; vnetid = VNET_VIF + i; vnet->vnet = toVnetId(vnetid); - sprintf(vnet->device, "vnif%04x", vnetid); + snprintf(vnet->device, sizeof(vnet->device), "vnif%04x", vnetid); vnet->security = (vnetid > 10 ? security : 0); err = Vnet_create(vnet); Vnet_decref(vnet); |