- utils.c: overflowing size_t is basically impossible, but well...
- stats.c: NULL would probably not cause a problem with zero length passed
for (unsigned i = 0; i < n; ++i) {
char *item = va_arg(vl, char *);
const size_t new_len = total_len + strlen_safe(item);
- if (unlikely(new_len < total_len)) return NULL;
+ if (unlikely(new_len < total_len)) {
+ va_end(vl);
+ return NULL;
+ }
total_len = new_len;
}
va_end(vl);
size_t args_len = args ? strlen(args) : 0;
for (unsigned i = 0; i < metric_const_end; ++i) {
struct const_metric_elm *elm = &const_metrics[i];
- if (strncmp(elm->key, args, args_len) == 0) {
+ if (args && strncmp(elm->key, args, args_len) == 0) {
json_append_member(root, elm->key, json_mknumber(elm->val));
}
}