aboutsummaryrefslogtreecommitdiff
path: root/lib/dgram.js
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2012-02-23 01:51:27 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2012-02-23 02:07:39 +0100
commitdefa637378ae3ce3978908c7b604082308868a8c (patch)
tree0e57bbdbb27af93f1799c3fbf8953875025b3567 /lib/dgram.js
parentfd61bfc73195063d984e7a1d3594015c7d5f4e25 (diff)
downloadandroid-node-v8-defa637378ae3ce3978908c7b604082308868a8c.tar.gz
android-node-v8-defa637378ae3ce3978908c7b604082308868a8c.tar.bz2
android-node-v8-defa637378ae3ce3978908c7b604082308868a8c.zip
dgram: fix out-of-bound memory read
Diffstat (limited to 'lib/dgram.js')
-rw-r--r--lib/dgram.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/dgram.js b/lib/dgram.js
index 8a88364bb5..ae280c737d 100644
--- a/lib/dgram.js
+++ b/lib/dgram.js
@@ -165,6 +165,12 @@ Socket.prototype.send = function(buffer,
callback) {
var self = this;
+ if (offset >= buffer.length)
+ throw new Error('Offset into buffer too large');
+
+ if (offset + length > buffer.length)
+ throw new Error('Offset + length beyond buffer length');
+
callback = callback || noop;
self._healthCheck();