{
uint64_t val;
const user_config_t *conf;
- const char *class;
const char *name;
if (pt == NULL)
conf = priv;
#if HAVE_VARNISH_V5
- char namebuff[100];
- char *c;
+ char namebuff[DATA_MAX_NAME_LEN];
- c = rindex(pt->name, '.');
- strcpy(namebuff, c + 1);
+ char const *c = strrchr(pt->name, '.');
+ if (c == NULL) {
+ return EINVAL;
+ }
+ sstrncpy(namebuff, c + 1, sizeof(namebuff));
name = namebuff;
- (void)class;
-
#elif HAVE_VARNISH_V4
- class = pt->section->fantom->type;
- name = pt->desc->name;
-
- if (strcmp(class, "MAIN") != 0)
+ if (strcmp(pt->section->fantom->type, "MAIN") != 0)
return 0;
+ name = pt->desc->name;
#elif HAVE_VARNISH_V3
- class = pt->class;
- name = pt->name;
-
- if (strcmp(class, "") != 0)
+ if (strcmp(pt->class, "") != 0)
return 0;
+
+ name = pt->name;
#endif
val = *(const volatile uint64_t *)pt->ptr;