+Noteworthy changes in lopsub-1.0.4 (2023-07-02)
+===============================================
+* make the build reproducible (Chris Lamb, Vagrant Cascadian)
+* improvements to the build system
+* documentation fixes
+* avoid NULL pointer dereference in argument parsing
+
Noteworthy changes in lopsub-1.0.3 (2019-05-19)
===============================================
* build a shared library instead of a static one
+liblopsub (1.0.4-1) unstable; urgency=low
+
+ * Make the build reproducible (Chris Lamb, Vagrant Cascadian). Closes:
+ #1039617, #1039618
+ * Avoid crash due to a NULL pointer dereference in certain cases
+ * Minor cleanups and fixes, see NEWS for details.
+
+ -- Andre Noll <maan@tuebingen.mpg.de> Sun, 02 Jul 2023 14:12:13 +0200
+
liblopsub (1.0.3-2) unstable; urgency=low
* Make the output of lopsubgen reproducible.
bool multiple;
int idx, ret;
- if (!la->arg)
- goto success;
- if (opt->arg_info == LLS_NO_ARGUMENT) {
+ if (la->arg && opt->arg_info == LLS_NO_ARGUMENT) {
xasprintf(errctx, "arg: %s, option: %s", la->arg, opt->name);
return -E_LLS_ARG_GIVEN;
}
multiple = opt->flags & LLS_MULTIPLE;
+ if (opt->arg_type == LLS_STRING && !opt->values && !multiple) {
+ if (lor->value) { /* discard previous value */
+ free(lor->value[0].string_val);
+ free(lor->value);
+ lor->value = NULL;
+ }
+ }
+ if (!la->arg)
+ goto success;
idx = multiple? lor->given : 0;
- if (lor->given == 0 || multiple) {
- ret = xrealloc(&lor->value,
- (lor->given + 1) * sizeof(*lor->value));
+ if (!lor->value || multiple) {
+ ret = xrealloc(&lor->value, (idx + 1) * sizeof(*lor->value));
if (ret < 0) {
xasprintf(errctx, "option value array for --%s",
opt->name);
}
switch (opt->arg_type) {
case LLS_STRING:
- if (!opt->values && lor->given > 0 && !multiple)
- free(lor->value[idx].string_val);
if (opt->values) {
ret = check_enum_arg(la->arg, opt, errctx);
if (ret < 0)
xasprintf(errctx, "no non-option args allowed, "
"%u given", lpr->num_inputs);
else
- xasprintf(errctx, "%s %u non-option args allowed, "
- "%u given", min_argc < max_argc?
- "at most" : "exactly",
- max_argc, lpr->num_inputs);
+ xasprintf(errctx, "%s %u non-option args %s, %u given",
+ min_argc < max_argc? "at most" : "exactly",
+ max_argc,
+ min_argc < max_argc? "allowed" : "required",
+ lpr->num_inputs);
return -E_LLS_BAD_ARG_COUNT;
}
return 1;