diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-11-05 20:37:09 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-11-08 15:46:50 +0100 |
commit | 927d030ae86335536b3bfdf9ce3aca98105a7f68 (patch) | |
tree | c9d91d15c8f017ee6e8a8a1c91fcf0c42945668b /src/host/layer23 | |
parent | 4f85fb30bc77e4bb4c3b9187a48a0a5a0a8cbb5a (diff) |
layer23: Avoid mempcy with NULL src
Fixes following ASan warning:
git/osmocom-bb/src/host/layer23/src/misc/../common/main.c:146:2: runtime error: null pointer passed as argument 2, which is declared to never be null
The warning however is harmless since in that case, app_len = 0 and thus
size to copy is 0.
Change-Id: I009a5b53f1e5be72ce347d64d3a7cb1d95d37ea3
Diffstat (limited to 'src/host/layer23')
-rw-r--r-- | src/host/layer23/src/common/main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/host/layer23/src/common/main.c b/src/host/layer23/src/common/main.c index 693b10e7..2920cd9e 100644 --- a/src/host/layer23/src/common/main.c +++ b/src/host/layer23/src/common/main.c @@ -143,7 +143,8 @@ static void build_config(char **opt, struct option **option) *option = talloc_zero_array(l23_ctx, struct option, len + app_len + 1); memcpy(*option, long_options, sizeof(long_options)); - memcpy(*option + len, app_opp, app_len * sizeof(struct option)); + if (app_opp) + memcpy(*option + len, app_opp, app_len * sizeof(struct option)); } static void handle_options(int argc, char **argv) |