mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-05 21:07:52 +00:00
Fix array bounds problem in hddtemp code.
This commit is contained in:
parent
4a08fab0e6
commit
d0de7cbd63
@ -91,6 +91,7 @@ static char *read_hdd_val(const char *line)
|
|||||||
return ret;
|
return ret;
|
||||||
/* read the device */
|
/* read the device */
|
||||||
dev = ++p;
|
dev = ++p;
|
||||||
|
if (!p) return ret;
|
||||||
if (!(p = strchr(p, line_s[0])))
|
if (!(p = strchr(p, line_s[0])))
|
||||||
return ret;
|
return ret;
|
||||||
*(p++) = '\0';
|
*(p++) = '\0';
|
||||||
@ -197,6 +198,7 @@ char *get_hddtemp_info(char *dev, char *hostaddr, int port)
|
|||||||
if ((p = read_hdd_val(buf)) == NULL)
|
if ((p = read_hdd_val(buf)) == NULL)
|
||||||
goto GET_OUT;
|
goto GET_OUT;
|
||||||
do {
|
do {
|
||||||
|
if (p >= buf + BUFLEN) break;
|
||||||
if (!strncmp(dev, p, strlen(dev)))
|
if (!strncmp(dev, p, strlen(dev)))
|
||||||
asprintf(&r, "%s", p + strlen(dev));
|
asprintf(&r, "%s", p + strlen(dev));
|
||||||
free(p);
|
free(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user