]> git.draconx.ca Git - dxcommon.git/commitdiff
Fix off-by-one error in gen-options.awk.
authorNick Bowler <nbowler@draconx.ca>
Sat, 6 Mar 2021 21:18:38 +0000 (16:18 -0500)
committerNick Bowler <nbowler@draconx.ca>
Sat, 6 Mar 2021 21:23:08 +0000 (16:23 -0500)
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
tests/scripts.at

index 30b820252a345b990e85ad9697e60da94d057c6c..1fd0fdb0b26aad50457873ea577f9d4612d59b80 100755 (executable)
@@ -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
     }
   }
 
index 4784b5994929953114c4c6c11e4cd7a3c97a95d6..d97a6c7c3d5d209ce493f8e6f371d89104e475f6 100644 (file)
@@ -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])