diff options
author | Eric Laurent <elaurent@google.com> | 2021-01-13 20:58:24 +0100 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2021-01-14 20:06:24 +0000 |
commit | 76e27cd788311ade589003cae5d910555b76a226 (patch) | |
tree | 6ea241a70764536c47044aeb51ce040174429368 | |
parent | fc8976c893235c8f2eb05e713493e995f22c2d1a (diff) | |
download | tinycompress-76e27cd788311ade589003cae5d910555b76a226.tar.gz |
fix build
Fix build breakage introduced by commit f86d1a2e
with strlcpy argument checks.
Test: make checkbuild
Change-Id: I3084f1e294d15a12923958af9170f00413fae2bb
Merged-In: I3084f1e294d15a12923958af9170f00413fae2bb
-rw-r--r-- | compress_plugin.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compress_plugin.c b/compress_plugin.c index 24d72ee..7a5538d 100644 --- a/compress_plugin.c +++ b/compress_plugin.c @@ -366,14 +366,15 @@ static int compress_plug_open(unsigned int card, unsigned int device, fprintf(stderr, "%s: invalid library name\n", __func__); goto err_open_fn; } - open_fn = calloc(1, strlen(name) + strlen("_open") + 1); + const size_t open_fn_size = strlen(name) + strlen("_open") + 1; + open_fn = calloc(1, open_fn_size); if (!open_fn) { rc = -ENOMEM; goto err_open_fn; } - strlcpy(open_fn, name, strlen(name) + 1); - strlcat(open_fn, "_open", strlen(name) + strlen("_open") + 1); + strlcpy(open_fn, name, open_fn_size); + strlcat(open_fn, "_open", open_fn_size); plug_data->plugin_open_fn = dlsym(dl_hdl, open_fn); if (!plug_data->plugin_open_fn) { |