~lbnz/xr0

681e762f3a5be8e421f0b654e55e7df3b2e532e4 — Amisi Kiarie a month ago 7846020 v0.15.1
fix: undefined behaviour in error_printf

resolves: https://github.com/xr0-org/xr0/issues/44
1 files changed, 3 insertions(+), 2 deletions(-)

M src/util/util.c
M src/util/util.c => src/util/util.c +3 -2
@@ 332,7 332,7 @@ error_nest(struct error *outer, struct error *inner)
struct error *
error_printf(char *fmt, ...)
{
	char *otherfmt;
	char *otherfmt; void *otherarg;
	struct error *inner;

	struct error *err = calloc(1, sizeof(struct error));


@@ 357,7 357,8 @@ error_printf(char *fmt, ...)
			break;
		default:
			otherfmt = findnextfmt(&p);
			strbuilder_vprintf(b, otherfmt, ap);
			otherarg = va_arg(ap, void *);
			strbuilder_printf(b, otherfmt, otherarg);
			free(otherfmt);
			p--; /* prepare for increment */
			break;