File ipxe-avoid-bad-array-reference.patch of Package kvm
Subject: Avoid overrunning array by conditional compilation
I haven't analyzed the best way to fix this, but this code error
has been there 'forever', so for now use a simple approach to avoid
the issue.
Signed-off-by: Bruce Rogers <brogers@suse.com>
Index: ipxe-1.0.0/src/util/nrv2b.c
===================================================================
--- ipxe-1.0.0.orig/src/util/nrv2b.c
+++ ipxe-1.0.0/src/util/nrv2b.c
@@ -629,7 +629,7 @@ static int swd_search2(struct ucl_swd *s
s->b[s->bp], s->b[s->bp+1], s->b[key], s->b[key+1]);
#endif
assert(memcmp(&s->b[s->bp],&s->b[key],2) == 0);
-#if defined(SWD_BEST_OFF)
+#if defined(SWD_BEST_OFF) && (SWD_BEST_OFF > 2)
if (s->best_pos[2] == 0)
s->best_pos[2] = key + 1;
#endif