diff options
author | midipix <writeonce@midipix.org> | 2016-03-10 03:55:31 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-03-10 08:32:40 -0500 |
commit | ef1e6e2a0c0a57c6d6492c5db006e488c6b3b051 (patch) | |
tree | a363b20f22597948285ae83213209ca439d488e9 /src/logic/slbt_exec_ctx.c | |
parent | e88a3938a2b09ecc0dad759a2602784cb224b58a (diff) | |
download | slibtool-ef1e6e2a0c0a57c6d6492c5db006e488c6b3b051.tar.bz2 slibtool-ef1e6e2a0c0a57c6d6492c5db006e488c6b3b051.tar.xz |
slbt_exec_ctx_alloc(): fix calculation of worst-case [overkill] buffer size.
Diffstat (limited to 'src/logic/slbt_exec_ctx.c')
-rw-r--r-- | src/logic/slbt_exec_ctx.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c index 40872a0..afd130c 100644 --- a/src/logic/slbt_exec_ctx.c +++ b/src/logic/slbt_exec_ctx.c @@ -65,9 +65,10 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc( argc = 0; csrc = 0; - /* clerical buffer size (guard, suffix, version) */ - size = strlen(".lo") + strlen(".libs/") + 2*sizeof('\0'); - size += 36*strlen(".0000") + 36*sizeof('\0'); + /* clerical [worst-case] buffer size (guard, .libs, version) */ + size = strlen(".lo") + sizeof('\0'); + size += 6 * (strlen(".libs/") + sizeof('\0')); + size += 36 * (strlen(".0000") + sizeof('\0')); /* buffer size (cargv, -Wc) */ for (parg=dctx->cctx->cargv; *parg; parg++, argc++) |