mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-01 22:58:40 -04:00
scanner, client: Added more error checks when strtol function is used
Signed-off-by: Imran Zaman <imran.zaman@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
ba6b79c577
commit
ff769d8fae
2 changed files with 7 additions and 2 deletions
|
|
@ -405,11 +405,13 @@ start_element(void *data, const char *element_name, const char **atts)
|
|||
message->destructor = 0;
|
||||
|
||||
if (since != NULL) {
|
||||
int prev_errno = errno;
|
||||
errno = 0;
|
||||
version = strtol(since, &end, 0);
|
||||
if (errno == EINVAL || end == since || *end != '\0')
|
||||
if (errno != 0 || end == since || *end != '\0')
|
||||
fail(&ctx->loc,
|
||||
"invalid integer (%s)\n", since);
|
||||
errno = prev_errno;
|
||||
} else {
|
||||
version = 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue