From 7cd29009c4beb86ed0e8d6b23b13e49a6041c592 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sat, 6 Mar 2021 16:18:38 -0500 Subject: [PATCH] Fix off-by-one error in gen-options.awk. When an option has no help text, the lopt_get_help function is returning a description pointer which is one past the end of the help text array, rather than a pointer to the final 0 byte as intended. The results are unpredictable. --- scripts/gen-options.awk | 2 +- tests/scripts.at | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/gen-options.awk b/scripts/gen-options.awk index 30b8202..1fd0fdb 100755 --- a/scripts/gen-options.awk +++ b/scripts/gen-options.awk @@ -295,7 +295,7 @@ END { opt = options[opt] if (!(opt in optionhelp)) { print "\tARG_L10N_(PN_(\"" opt "\", \"\"))" - help_offsets[opt] = help_pos + help_offsets[opt] = help_pos - 1 } } diff --git a/tests/scripts.at b/tests/scripts.at index 4784b59..d97a6c7 100644 --- a/tests/scripts.at +++ b/tests/scripts.at @@ -1,3 +1,9 @@ +dnl Copyright © 2021 Nick Bowler +dnl +dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2. +dnl This is free software: you are free to do what the fuck you want to. +dnl There is NO WARRANTY, to the extent permitted by law. + AT_BANNER([Script tests]) AT_SETUP([gen-options.awk]) -- 2.43.0