From ba4d6729fd97fe5cc3602d1b2f0bef1ec47029c5 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Sun, 19 Sep 2010 20:02:53 +0200 Subject: [PATCH] brcm80211fwconv: Complain if the index is invalid Signed-off-by: Michael Buesch --- disassembler/brcm80211fwconv | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/disassembler/brcm80211fwconv b/disassembler/brcm80211fwconv index 880abb5..092c043 100755 --- a/disassembler/brcm80211fwconv +++ b/disassembler/brcm80211fwconv @@ -161,9 +161,14 @@ def mergeSection(hdr_filepath, bin_filepath, mergeIndex, mergefilePath): newBin = [] newSections = [] newOffset = 0 + foundIt = False for section in sections: (offset, length, index) = section if index == mergeIndex: + if foundIt: + print "Confused. Multiple sections with index %d?" % index + return 1 + foundIt = True # We overwrite this section newBin.append(merge_data) newSections.append( (newOffset, len(merge_data), index) ) @@ -176,6 +181,9 @@ def mergeSection(hdr_filepath, bin_filepath, mergeIndex, mergefilePath): return 1 newSections.append( (newOffset, length, index) ) newOffset += length + if not foundIt: + print "Did not find section with index %d" % mergeIndex + return 1 newBin = "".join(newBin) newHdr = generateHeaderData(newSections) try: -- 2.31.1