termux-packages/packages/argp/fix-segfault.patch

35 lines
1.1 KiB
Diff

similar to https://www.gnu.org/software/gnutls/clang/report-NwyD8A.html
--- argp-standalone-1.3/argp-help.c 2003-12-11 14:07:05.000000000 +0530
+++ argp-standalone-1.3-patch/argp-help.c 2021-08-30 20:06:23.807999907 +0530
@@ -726,15 +726,20 @@
canon_doc_option (const char **name)
{
int non_opt;
- /* Skip initial whitespace. */
- while (isspace ( (unsigned char) **name))
- (*name)++;
- /* Decide whether this looks like an option (leading `-') or not. */
- non_opt = (**name != '-');
- /* Skip until part of name used for sorting. */
- while (**name && !isalnum ( (unsigned char) **name))
- (*name)++;
- return non_opt;
+
+ if(!*name)
+ non_opt = 1;
+ else {
+ /* Skip initial whitespace. */
+ while (isspace ( (unsigned char) **name))
+ (*name)++;
+ /* Decide whether this looks like an option (leading `-') or not. */
+ non_opt = (**name != '-');
+ /* Skip until part of name used for sorting. */
+ while (**name && !isalnum ( (unsigned char) **name))
+ (*name)++;
+ return non_opt;
+ }
}
/* Order ENTRY1 & ENTRY2 by the order which they should appear in a help