mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 15:10:33 +00:00
import: check overflow
Fixes CID#1548022 and CID#1548075.
This commit is contained in:
@@ -409,6 +409,11 @@ static int raw_import_process(RawImport *i) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if ((size_t) l > sizeof(i->buffer) - i->buffer_size) {
|
||||
r = log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "Read input file exceeded maximum size.");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
i->buffer_size += l;
|
||||
|
||||
if (i->compress.type == IMPORT_COMPRESS_UNKNOWN) {
|
||||
|
||||
@@ -276,6 +276,11 @@ static int tar_import_process(TarImport *i) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if ((size_t) l > sizeof(i->buffer) - i->buffer_size) {
|
||||
r = log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "Read input file exceeded maximum size.");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
i->buffer_size += l;
|
||||
|
||||
if (i->compress.type == IMPORT_COMPRESS_UNKNOWN) {
|
||||
|
||||
Reference in New Issue
Block a user