aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-08-14 14:54:42 +0200
committerFredrik Gustafsson <[email protected]>2013-08-14 14:54:42 +0200
commit23610dbfc1c409f83349e9e293dd3cfc1f74d497 (patch)
tree76522027b7b8c4ae22fe0f2a34460f0db340e32e /lib
parentd722dcb44dd3107b27c4969cf444011e2711572e (diff)
parent410bd502e75b22cfa355ffc11eb160360c20bd6f (diff)
downloadotp-23610dbfc1c409f83349e9e293dd3cfc1f74d497.tar.gz
otp-23610dbfc1c409f83349e9e293dd3cfc1f74d497.tar.bz2
otp-23610dbfc1c409f83349e9e293dd3cfc1f74d497.zip
Merge branch 'maint'
Diffstat (limited to 'lib')
-rw-r--r--lib/odbc/c_src/odbcserver.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/odbc/c_src/odbcserver.c b/lib/odbc/c_src/odbcserver.c
index 5730e20774..8de81a30ae 100644
--- a/lib/odbc/c_src/odbcserver.c
+++ b/lib/odbc/c_src/odbcserver.c
@@ -277,11 +277,15 @@ int main(void)
msg = receive_erlang_port_msg();
temp = strtok(msg, ";");
+ if (temp == NULL)
+ DO_EXIT(EXIT_STDIN_BODY);
length = strlen(temp);
supervisor_port = safe_malloc(length + 1);
strcpy(supervisor_port, temp);
temp = strtok(NULL, ";");
+ if (temp == NULL)
+ DO_EXIT(EXIT_STDIN_BODY);
length = strlen(temp);
odbc_port = safe_malloc(length + 1);
strcpy(odbc_port, temp);
@@ -1819,12 +1823,20 @@ static byte * receive_erlang_port_msg(void)
len |= lengthstr[i];
}
+ if (len <= 0 || len > 1024) {
+ DO_EXIT(EXIT_STDIN_HEADER);
+ }
+
buffer = (byte *)safe_malloc(len);
if (read_exact(buffer, len) <= 0) {
DO_EXIT(EXIT_STDIN_BODY);
}
+ if (buffer[len-1] != '\0') {
+ DO_EXIT(EXIT_STDIN_BODY);
+ }
+
return buffer;
}