Package: powerpc-utils
Severity: normal
Tags: patch
nvsetenv segfaults on efika, because for some reason /dev/nvram is full of
bogus 0xff.
I think nvsetenv should fail gracefuly instead. See attached patch.
Note: I assume MXSTRING means the obvious, but I don't know how to check. Let
me know if that's not correct ;-)
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-amd64
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
diff -ur powerpc-utils-1.1.3.old/nvsetenv.c powerpc-utils-1.1.3/nvsetenv.c
--- powerpc-utils-1.1.3.old/nvsetenv.c 2007-06-29 21:42:35.000000000 +0200
+++ powerpc-utils-1.1.3/nvsetenv.c 2007-06-29 22:52:37.000000000 +0200
@@ -161,6 +161,10 @@
case string:
off = nvbuf.nv.vals[vi] >> 16;
len = nvbuf.nv.vals[vi++] & 0xffff;
+ if (len > MXSTRING) {
+ (void) fprintf(stderr, "string value in variable %d is too long
(%d bytes)\n", i, len);
+ exit(EXIT_FAILURE);
+ }
nvvals[i].str_val = nvstrbuf + nvstr_used;
memcpy(nvvals[i].str_val, nvbuf.c + off - NVSTART, (size_t) len);
nvvals[i].str_val[len] = (char) 0;