mirror of git://git.sysmocom.de/ofono
Fix: Use snprintf instead of sprintf in the core
This commit is contained in:
parent
dfab0764da
commit
dc16aa7937
|
@ -230,11 +230,11 @@ static void set_new_cond_list(struct ofono_call_forwarding *cf,
|
|||
timeout = lc->time;
|
||||
number = phone_number_to_string(&lc->phone_number);
|
||||
|
||||
sprintf(attr, "%s%s", bearer_class_to_string(lc->cls),
|
||||
cf_type_lut[type]);
|
||||
snprintf(attr, sizeof(attr), "%s%s",
|
||||
bearer_class_to_string(lc->cls), cf_type_lut[type]);
|
||||
|
||||
if (type == CALL_FORWARDING_TYPE_NO_REPLY)
|
||||
sprintf(tattr, "%sTimeout", attr);
|
||||
snprintf(tattr, sizeof(tattr), "%sTimeout", attr);
|
||||
|
||||
o = g_slist_find_custom(old, GINT_TO_POINTER(lc->cls),
|
||||
cf_condition_find_with_cls);
|
||||
|
@ -283,11 +283,11 @@ static void set_new_cond_list(struct ofono_call_forwarding *cf,
|
|||
for (o = old; o; o = o->next) {
|
||||
oc = o->data;
|
||||
|
||||
sprintf(attr, "%s%s", bearer_class_to_string(oc->cls),
|
||||
cf_type_lut[type]);
|
||||
snprintf(attr, sizeof(attr), "%s%s",
|
||||
bearer_class_to_string(oc->cls), cf_type_lut[type]);
|
||||
|
||||
if (type == CALL_FORWARDING_TYPE_NO_REPLY)
|
||||
sprintf(tattr, "%sTimeout", attr);
|
||||
snprintf(tattr, sizeof(tattr), "%sTimeout", attr);
|
||||
|
||||
ofono_dbus_signal_property_changed(conn, path,
|
||||
OFONO_CALL_FORWARDING_INTERFACE, attr,
|
||||
|
@ -314,11 +314,12 @@ static inline void property_append_cf_condition(DBusMessageIter *dict, int cls,
|
|||
char tattr[64];
|
||||
int addt = !strcmp(postfix, "NoReply");
|
||||
|
||||
sprintf(attr, "%s%s", bearer_class_to_string(cls), postfix);
|
||||
snprintf(attr, sizeof(attr), "%s%s",
|
||||
bearer_class_to_string(cls), postfix);
|
||||
|
||||
if (addt)
|
||||
sprintf(tattr, "%s%sTimeout", bearer_class_to_string(cls),
|
||||
postfix);
|
||||
snprintf(tattr, sizeof(tattr), "%s%sTimeout",
|
||||
bearer_class_to_string(cls), postfix);
|
||||
|
||||
ofono_dbus_dict_append(dict, attr, DBUS_TYPE_STRING, &value);
|
||||
|
||||
|
|
|
@ -292,7 +292,8 @@ static void set_cw(struct ofono_call_settings *cs, int new_cw, int mask)
|
|||
else
|
||||
value = "disabled";
|
||||
|
||||
sprintf(buf, "%sCallWaiting", bearer_class_to_string(j));
|
||||
snprintf(buf, sizeof(buf), "%sCallWaiting",
|
||||
bearer_class_to_string(j));
|
||||
ofono_dbus_signal_property_changed(conn, path,
|
||||
OFONO_CALL_SETTINGS_INTERFACE,
|
||||
buf, DBUS_TYPE_STRING,
|
||||
|
@ -313,7 +314,8 @@ static void property_append_cw_conditions(DBusMessageIter *dict,
|
|||
if (!(mask & i))
|
||||
continue;
|
||||
|
||||
sprintf(prop, "%sCallWaiting", bearer_class_to_string(i));
|
||||
snprintf(prop, sizeof(prop), "%sCallWaiting",
|
||||
bearer_class_to_string(i));
|
||||
|
||||
if (conditions & i)
|
||||
value = "enabled";
|
||||
|
|
|
@ -178,7 +178,7 @@ static void vcard_printf_number(GString *vcards, const char *number, int type,
|
|||
if ((type == TYPE_INTERNATIONAL) && (number[0] != '+'))
|
||||
intl = "+";
|
||||
|
||||
sprintf(buf, "TEL;TYPE=\%s%s:\%s\%s", pref,
|
||||
snprintf(buf, sizeof(buf), "TEL;TYPE=\%s%s:\%s\%s", pref,
|
||||
category_string, intl, number);
|
||||
vcard_printf(vcards, buf, number);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue