From 7e8e4a7736aeaddb622871b92f843f7b426bcb88 Mon Sep 17 00:00:00 2001 From: dfr Date: Sun, 23 May 2004 10:06:33 +0000 Subject: Don't crash if the CROM is all zeros. --- usr.sbin/fwcontrol/fwcontrol.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'usr.sbin/fwcontrol/fwcontrol.c') diff --git a/usr.sbin/fwcontrol/fwcontrol.c b/usr.sbin/fwcontrol/fwcontrol.c index a7465f5..99c13a6 100644 --- a/usr.sbin/fwcontrol/fwcontrol.c +++ b/usr.sbin/fwcontrol/fwcontrol.c @@ -326,6 +326,10 @@ show_crom(u_int32_t *crom_buf) crom_init_context(&cc, crom_buf); dir = cc.stack[0].dir; + if (!dir) { + printf("no root directory - giving up\n"); + return; + } printf("root_directory: len=0x%04x(%d) crc=0x%04x", dir->crc_len, dir->crc_len, dir->crc); crc = crom_crc((u_int32_t *)&dir->entry[0], dir->crc_len); -- cgit v1.1