From: John Crispin Date: Tue, 6 Aug 2013 14:32:50 +0000 (+0000) Subject: firmware-utils: fix segfault introduced by v2 changes X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=eac7e91329b20e2c1a7cd241b5151ff7c21d967d;p=openwrt%2Fsvn-archive%2Farchive.git firmware-utils: fix segfault introduced by v2 changes Signed-off-by: Bastian Bittorf SVN-Revision: 37724 --- diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c index 05e40c5daf..f6fdff4943 100644 --- a/tools/firmware-utils/src/mktplinkfw.c +++ b/tools/firmware-utils/src/mktplinkfw.c @@ -811,7 +811,7 @@ static int build_fw(void) int ret = EXIT_FAILURE; int writelen = 0; int hdr_len; - if (board->hdr_version == HEADER_VERSION_V2) + if (board && board->hdr_version == HEADER_VERSION_V2) hdr_len = sizeof(struct fw_header_v2); else hdr_len = sizeof(struct fw_header); @@ -854,7 +854,7 @@ static int build_fw(void) if (!strip_padding) writelen = buflen; - if (board->hdr_version == HEADER_VERSION_V2) + if (board && board->hdr_version == HEADER_VERSION_V2) fill_header_v2(buf, writelen); else fill_header(buf, writelen);