mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-12 08:58:20 +03:00
import: check overflow
Fixes CID#1548022 and CID#1548075. (cherry picked from commit f7012a93a7f04fa29c7933a4963aa17fcf120e97) (cherry picked from commit 11c15905cd4759b89a1da63d05772c1f7c3744a4) (cherry picked from commit a920cc9b3a8fc8b9ee57fa5c4a30d9234eb7a819) (cherry picked from commit ff17a1023e2715ee5f54cc741b47e1eb1c444f35)
This commit is contained in:
parent
9d9458a00e
commit
2d261daa16
@ -408,6 +408,11 @@ static int raw_import_process(RawImport *i) {
|
|||||||
goto finish;
|
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;
|
i->buffer_size += l;
|
||||||
|
|
||||||
if (i->compress.type == IMPORT_COMPRESS_UNKNOWN) {
|
if (i->compress.type == IMPORT_COMPRESS_UNKNOWN) {
|
||||||
|
@ -275,6 +275,11 @@ static int tar_import_process(TarImport *i) {
|
|||||||
goto finish;
|
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;
|
i->buffer_size += l;
|
||||||
|
|
||||||
if (i->compress.type == IMPORT_COMPRESS_UNKNOWN) {
|
if (i->compress.type == IMPORT_COMPRESS_UNKNOWN) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user