commit: b71b21d13405857d95cff02551558fed0c4d356e Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Sat May 16 18:50:19 2020 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Sat May 16 18:50:19 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=b71b21d1
main: use sizeof iso strlen to enforce compile-time constants Bug: https://bugs.gentoo.org/723422 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 76a6ffb..aa7eae2 100644 --- a/main.c +++ b/main.c @@ -601,8 +601,10 @@ env_vars vars_to_read[] = { .default_value = d, \ .src = NULL, \ }, -#define _Q_EVS(t, V, v, d) _Q_EV(t, V, .value.s = &v, .value_len = strlen(d), d) -#define _Q_EVB(t, V, v, d) _Q_EV(t, V, .value.b = &v, .value_len = 0, d) +#define _Q_EVS(t, V, v, d) \ + _Q_EV(t, V, .value.s = &v, .value_len = sizeof(d) - 1, d) +#define _Q_EVB(t, V, v, d) \ + _Q_EV(t, V, .value.b = &v, .value_len = 0, d) _Q_EVS(STR, ROOT, portroot, "/") _Q_EVS(STR, ACCEPT_LICENSE, accept_license, "")
