[master] check file and tree headers when loading map files

4792.	[bug]		Fix map file header correctness check. [RT #38418]
This commit is contained in:
Evan Hunt
2017-10-25 21:37:00 -07:00
parent 89d1777560
commit 5b69d3da83
4 changed files with 71 additions and 8 deletions

View File

@@ -238,6 +238,16 @@ done
[ $ret -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
# stomp on the file header
echo "I:checking corrupt map files fail to load (bad file header)"
ret=0
./named-compilezone -D -f text -F map -o map.5 example.nil baseline.txt > /dev/null
cp map.5 badmap
stomp badmap 0 32 99
./named-compilezone -D -f map -F text -o text.5 example.nil badmap > /dev/null
[ $? = 1 ] || ret=1
[ $ret -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
# stomp on the file data so it hashes differently.
# these are small and subtle changes, so that the resulting file
# would appear to be a legitimate map file and would not trigger an
@@ -245,7 +255,6 @@ status=`expr $status + $ret`
# load because of a SHA1 hash mismatch.
echo "I:checking corrupt map files fail to load (bad node header)"
ret=0
./named-compilezone -D -f text -F map -o map.5 example.nil baseline.txt > /dev/null
cp map.5 badmap
stomp badmap 2754 2 99
./named-compilezone -D -f map -F text -o text.5 example.nil badmap > /dev/null