Avoid snprintf and having buffer on stack.

This commit is contained in:
Michael Drake 2013-07-26 12:16:53 +01:00
parent 7bbcec90c4
commit b0baa839e8
1 changed files with 6 additions and 7 deletions

View File

@ -623,7 +623,6 @@ error:
*/
static nserror cookie_manager_init_common_values(void)
{
char buffer[24];
const char *temp;
/* Set the Restrictions text */
@ -645,18 +644,18 @@ static nserror cookie_manager_init_common_values(void)
&cm_ctx.values[CM_NONE], temp);
/* Set the Cookie version text */
snprintf(buffer, sizeof(buffer), "TreeVersion%i", COOKIE_NETSCAPE);
temp = messages_get(buffer);
assert(COOKIE_NETSCAPE == 0);
temp = messages_get("TreeVersion0");
cookie_manager_field_builder(CM_VERSION,
&cm_ctx.values[CM_NETSCAPE], temp);
snprintf(buffer, sizeof(buffer), "TreeVersion%i", COOKIE_RFC2109);
temp = messages_get(buffer);
assert(COOKIE_RFC2109 == 1);
temp = messages_get("TreeVersion1");
cookie_manager_field_builder(CM_VERSION,
&cm_ctx.values[CM_RFC2109], temp);
snprintf(buffer, sizeof(buffer), "TreeVersion%i", COOKIE_RFC2965);
temp = messages_get(buffer);
assert(COOKIE_RFC2965 == 2);
temp = messages_get("TreeVersion2");
cookie_manager_field_builder(CM_VERSION,
&cm_ctx.values[CM_RFC2965], temp);