int cpu_mem_parser(char *data, const char **p, void **state)
{
+ int ret;
char cpu[RRD_DATA_MAX_LEN], mem[RRD_DATA_MAX_LEN];
cpu_parser(cpu, p, state);
mem_parser(mem, p, state);
- snprintf(data, RRD_DATA_MAX_LEN, "%s:%s", cpu, mem);
+ ret = snprintf(data, RRD_DATA_MAX_LEN, "%s:%s", cpu, mem);
+
+ /* No actual data overflow, snprintf just couldn't fit all data in the buffer */
+ if (ret >= RRD_DATA_MAX_LEN)
+ pr_err("Buffer overlfow\n");
return 0;
}
static int make_uncached(char *path, size_t len)
{
+ int ret;
char p1[1024], p2[1024], *p = path;
if (strstr(path, "/uncached/"))
strncpy(p1, path, sizeof(p1) - 1);
strncpy(p2, p, sizeof(p2) - 1);
- snprintf(path, len, "%s/uncached/%s", p1, p2);
+ ret = snprintf(path, len, "%s/uncached/%s", p1, p2);
+
+ /* No actual data overflow, snprintf just couldn't fit all data in the buffer */
+ if (ret >= RRD_DATA_MAX_LEN)
+ pr_err("Buffer overlfow\n");
return 0;
}