CLEANUP: opentracing: remove the last two occurrences of strncat()
In flt_ot_sample_to_str() there were two occurrences of strncat() which are used to copy N chars from the source and append a zero. For the sake of definitely getting rid of this nasty function let's replace them by memcpy() instead. It's worth noting that the length test there appeared to be incorrect as it didn't make provisions for the trailing zero, unless the size argument doesn't take it into account (seems unlikely). Nothing was changed regarding this. If the code was good, it still is, otherwise if it was bad it still is. At least this is more obvious now than when using a function that needs n+1 chars to work.
This commit is contained in:
parent
fc458ec8aa
commit
ad44939e40
|
@ -553,8 +553,8 @@ int flt_ot_sample_to_str(const struct sample_data *data, char *value, size_t siz
|
|||
}
|
||||
else if (data->u.str.data > 0) {
|
||||
retval = data->u.str.data;
|
||||
|
||||
(void)strncat(value, data->u.str.area, retval);
|
||||
memcpy(value, data->u.str.area, retval);
|
||||
value[retval] = '\0';
|
||||
}
|
||||
else {
|
||||
/*
|
||||
|
@ -615,8 +615,8 @@ int flt_ot_sample_to_str(const struct sample_data *data, char *value, size_t siz
|
|||
FLT_OT_ERR("sample data size too large");
|
||||
} else {
|
||||
retval = data->u.meth.str.data;
|
||||
|
||||
(void)strncat(value, data->u.meth.str.area, retval);
|
||||
memcpy(value, data->u.meth.str.area, retval);
|
||||
value[retval] = '\0';
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue