Commit r1072 removed a couple of NULL pointer checks for package arguments,
however if the arguments are empty in Forth then they are converted back to a
NULL pointer which causes an exception when dereferenced.
Add the checks back in which fixes boot of the debian_lenny_powerpc_small.qcow2
test image with quik once again. Based upon an earlier patch by Alexander Graf
<agraf(a)suse.de>.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
CC: Alexander Garf <agraf(a)suse.de>
---
openbios-devel/packages/mac-parts.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/openbios-devel/packages/mac-parts.c b/openbios-devel/packages/mac-parts.c
index d0cba05..12c94e5 100644
--- a/openbios-devel/packages/mac-parts.c
+++ b/openbios-devel/packages/mac-parts.c
@@ -68,7 +68,7 @@ macparts_open( macparts_info_t *di )
[(id)][,][filespec]
*/
- if ( strlen(str) ) {
+ if ( str && strlen(str) ) {
/* Detect the arguments */
if ((*str >= '0' && *str <= '9') || (*str == ',')) {
push_str(str);
@@ -126,7 +126,7 @@ macparts_open( macparts_info_t *di )
* Implement partition selection as per the PowerPC Microprocessor CHRP bindings
*/
- if (parnum == 0) {
+ if (str == NULL || parnum == 0) {
/* According to the spec, partition 0 as well as no arguments means the whole disk */
offs = (long long)0;
size = (long long)__be32_to_cpu(dmap.sbBlkCount) * bs;
--
1.7.10.4