1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

varlink: don't panic on malformed method definition

This commit is contained in:
Frantisek Sumsal 2023-10-12 15:55:12 +02:00
parent 13de7c7e66
commit 779e7b4410
2 changed files with 12 additions and 0 deletions

View File

@ -986,6 +986,9 @@ int varlink_idl_parse(
assert(!symbol);
n_fields = 0;
if (!token)
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "%u:%u: Premature EOF.", *line, *column);
r = varlink_symbol_realloc(&symbol, n_fields);
if (r < 0)
return r;
@ -1004,6 +1007,9 @@ int varlink_idl_parse(
case STATE_METHOD_ARROW:
assert(symbol);
if (!token)
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "%u:%u: Premature EOF.", *line, *column);
if (!streq(token, "->"))
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "%u:%u: Unexpected token '%s'.", *line, *column, token);
@ -1025,6 +1031,9 @@ int varlink_idl_parse(
assert(!symbol);
n_fields = 0;
if (!token)
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "%u:%u: Premature EOF.", *line, *column);
r = varlink_symbol_realloc(&symbol, n_fields);
if (r < 0)
return r;
@ -1050,6 +1059,9 @@ int varlink_idl_parse(
assert(!symbol);
n_fields = 0;
if (!token)
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "%u:%u: Premature EOF.", *line, *column);
r = varlink_symbol_realloc(&symbol, n_fields);
if (r < 0)
return r;

Binary file not shown.