summaryrefslogtreecommitdiff
path: root/ndisasm.c
diff options
context:
space:
mode:
authorEd Beroset <beroset@mindspring.com>2004-12-15 18:27:21 +0000
committerEd Beroset <beroset@mindspring.com>2004-12-15 18:27:21 +0000
commit602f1df356d8ca6b8664f8b4728e6fcd162763b3 (patch)
tree61aa9de428972e30d89ab06e51c5f7b79f104b41 /ndisasm.c
parentb30ff1f2846e709e86896517f93ceed9de2f69e3 (diff)
downloadnasm-602f1df356d8ca6b8664f8b4728e6fcd162763b3.tar.gz
nasm-602f1df356d8ca6b8664f8b4728e6fcd162763b3.tar.bz2
nasm-602f1df356d8ca6b8664f8b4728e6fcd162763b3.zip
added buffer length parameter to prevent vulnerability to buffer
overflow exploits.
Diffstat (limited to 'ndisasm.c')
-rw-r--r--ndisasm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ndisasm.c b/ndisasm.c
index 71d07df..a167d87 100644
--- a/ndisasm.c
+++ b/ndisasm.c
@@ -243,10 +243,10 @@ int main(int argc, char **argv)
nextsync = next_sync (offset, &synclen);
}
while (p > q && (p - q >= INSN_MAX || lenread == 0)) {
- lendis = disasm (q, outbuf, bits, offset, autosync, prefer);
+ lendis = disasm (q, outbuf, sizeof(outbuf), bits, offset, autosync, prefer);
if (!lendis || lendis > (p - q) ||
(unsigned long)lendis > nextsync-offset)
- lendis = eatbyte (q, outbuf);
+ lendis = eatbyte (q, outbuf, sizeof(outbuf));
output_ins (offset, q, lendis, outbuf);
q += lendis;
offset += lendis;