diff --git a/src/hddtemp.c b/src/hddtemp.c index a622f6bb..5b1e22e7 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -84,10 +84,10 @@ static char *read_hdd_val(const char *line) char *ret = NULL; if (line) { - snprintf(line_s, 512, "%s", line); + if (!snprintf(line_s, 512, "%s", line)) return ret; p = line_s; } - if (!(*line_s)) + if (!(*line_s) || !p) return ret; /* read the device */ dev = ++p;