[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Buffer overflow bug in Bash
From: |
Ben Okopnik |
Subject: |
Buffer overflow bug in Bash |
Date: |
Thu, 19 Dec 2013 14:51:19 -0600 |
Hi -
Here's a couple of scripts, stripped down to bare bones and tested on
several recent bash versions; both cause a crash, with the following errors
in all cases:
./borked1: line 6: n/core-default.xml: expression recursion level exceeded
(error token is "n/core-default.xml")
./borked2: line 6: on/core-default.xml: division by 0 (error token is
"-default.xml")
Scripts (these differ by only one character, 'for n in n/' vs. 'for n in
on/'):
----------------------------------------------------------------------------------------------------------------------
#!/bin/bash
declare -A x
x[/etc/hadoop/conf/core-default.xml]=x
for n in n/core-default.xml
do
f="/etc/hadoop/conf/`basename $n`"
if [ -n "${x[$f]}" ]; then for m in ${foo[$n]}; do echo; done
fi
done
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
#!/bin/bash
declare -A x
x[/etc/hadoop/conf/core-default.xml]=x
for n in on/core-default.xml
do
f="/etc/hadoop/conf/`basename $n`"
if [ -n "${x[$f]}" ]; then for m in ${foo[$n]}; do echo; done
fi
done
----------------------------------------------------------------------------------------------------------------------
Best regards,
--
Ben Okopnik
- Buffer overflow bug in Bash,
Ben Okopnik <=