From: Sage Weil Date: Sun, 21 Aug 2011 21:10:41 +0000 (-0700) Subject: escape: use snprintf X-Git-Tag: v0.35~309 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b5a2ad0e86b49c84d7576db9387c86d07364c98b;p=ceph.git escape: use snprintf Coverity cid 41, 40 Signed-off-by: Sage Weil --- diff --git a/src/common/escape.c b/src/common/escape.c index 3249df11b97f..f46f2bdd0f78 100644 --- a/src/common/escape.c +++ b/src/common/escape.c @@ -99,7 +99,7 @@ void escape_xml_attr(const char *buf, char *out) // Escape control characters. if (((c < 0x20) && (c != 0x09) && (c != 0x0a)) || (c == 0x7f)) { - sprintf(o, "&#x%02x;", c); + snprintf(o, 6, "&#x%02x;", c); o += 6; } else { @@ -185,7 +185,7 @@ void escape_json_attr(const char *buf, char *out) default: // Escape control characters. if ((c < 0x20) || (c == 0x7f)) { - sprintf(o, "\\%04x", c); + snprintf(o, 5, "\\%04x", c); o += 5; } else {