mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-15 03:43:50 +00:00
relying on the return value of scanf when using %n is bad
This commit is contained in:
parent
5d69d0378f
commit
580043075e
@ -1336,8 +1336,8 @@ static struct text_object *construct_text_object(const char *s,
|
|||||||
END OBJ(buffers, INFO_BUFFERS)
|
END OBJ(buffers, INFO_BUFFERS)
|
||||||
END OBJ(cached, INFO_BUFFERS)
|
END OBJ(cached, INFO_BUFFERS)
|
||||||
#define SCAN_CPU(__arg, __var) { \
|
#define SCAN_CPU(__arg, __var) { \
|
||||||
int __offset; \
|
int __offset = 0; \
|
||||||
if (__arg && sscanf(__arg, " cpu%u %n", &__var, &__offset) == 2) \
|
if (__arg && sscanf(__arg, " cpu%u %n", &__var, &__offset) > 0) \
|
||||||
__arg += __offset; \
|
__arg += __offset; \
|
||||||
else \
|
else \
|
||||||
__var = 0; \
|
__var = 0; \
|
||||||
|
Loading…
Reference in New Issue
Block a user