diff options
author | Bui Nguyen Quoc Thanh <49302843+thanhbnq@users.noreply.github.com> | 2021-05-12 10:08:29 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-12 10:08:29 +0700 |
commit | f5344f8cf036e6dcb899522e8e679639dd23e1a4 (patch) | |
tree | c193ae5c2b919f89415a815b78ab54a7661a2619 /src/shared/dlt_common.c | |
parent | b95044abb202838837b0566efc40ae26308a4bb4 (diff) | |
parent | ad8a6ab070803f2b0e0fa177fd6638c10db2dde3 (diff) | |
download | DLT-daemon-f5344f8cf036e6dcb899522e8e679639dd23e1a4.tar.gz |
Merge pull request from GHSA-7cqp-2hqj-mh3f
daemon: check the conf inputs
Diffstat (limited to 'src/shared/dlt_common.c')
-rw-r--r-- | src/shared/dlt_common.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c index 9fe6c88..507c8ad 100644 --- a/src/shared/dlt_common.c +++ b/src/shared/dlt_common.c @@ -2350,6 +2350,14 @@ DltReturnValue dlt_buffer_init_dynamic(DltBuffer *buf, uint32_t min_size, uint32 head->write = 0; head->count = 0; buf->mem = (unsigned char *)(buf->shm + sizeof(DltBufferHead)); + + if (buf->min_size < (uint32_t)sizeof(DltBufferHead)) { + dlt_vlog(LOG_ERR, + "%s: min_size is too small [%u]\n", + __func__, buf->min_size); + return DLT_RETURN_WRONG_PARAMETER; + } + buf->size = (uint32_t) (buf->min_size - sizeof(DltBufferHead)); dlt_vlog(LOG_DEBUG, |