1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

jabber: use safe snprintf instead of sprintf

This commit is contained in:
Dmitry Podgorny 2012-11-13 17:57:27 +02:00
parent a114fe88b8
commit 1824704466

View File

@ -316,9 +316,9 @@ jabber_update_presence(jabber_presence_t status, const char * const msg)
xmpp_stanza_t *presence = stanza_create_presence(jabber_conn.ctx, show, msg); xmpp_stanza_t *presence = stanza_create_presence(jabber_conn.ctx, show, msg);
if (pri != 0) { if (pri != 0) {
xmpp_stanza_t *priority, *value; xmpp_stanza_t *priority, *value;
char pri_str[5]; char pri_str[10];
sprintf(pri_str, "%d", pri); snprintf(pri_str, sizeof(pri_str), "%d", pri);
priority = xmpp_stanza_new(jabber_conn.ctx); priority = xmpp_stanza_new(jabber_conn.ctx);
value = xmpp_stanza_new(jabber_conn.ctx); value = xmpp_stanza_new(jabber_conn.ctx);
xmpp_stanza_set_name(priority, STANZA_NAME_PRIORITY); xmpp_stanza_set_name(priority, STANZA_NAME_PRIORITY);