aboutsummaryrefslogtreecommitdiffstats
path: root/erts/etc/common/dialyzer.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-10-14 14:50:58 +0200
committerBjörn Gustavsson <[email protected]>2010-10-14 14:51:03 +0200
commitc7f811b03aca427fbea0cac5307b81fa19bddbc1 (patch)
tree96a2b390b50527199660a9fece17272c89ec402d /erts/etc/common/dialyzer.c
parent0cfaafd999d74a085d6f3e212e90985700040691 (diff)
parent0983ce5264f277c9b7798758082eee1c7addb337 (diff)
downloadotp-c7f811b03aca427fbea0cac5307b81fa19bddbc1.tar.gz
otp-c7f811b03aca427fbea0cac5307b81fa19bddbc1.tar.bz2
otp-c7f811b03aca427fbea0cac5307b81fa19bddbc1.zip
Merge branch 'ms/security-fixes' into dev
* ms/security-fixes: erlc: remove unused variable typer: prevent buffer overflows run_test: prevent buffer overflow heart: prevent buffer overflow escript: prevent buffer overflows erlexec: prevent buffer overflows erlc: prevent buffer overflows dialyzer: prevent buffer overflows OTP-8892
Diffstat (limited to 'erts/etc/common/dialyzer.c')
-rw-r--r--erts/etc/common/dialyzer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/erts/etc/common/dialyzer.c b/erts/etc/common/dialyzer.c
index 4b4c1124f1..4453e63f1c 100644
--- a/erts/etc/common/dialyzer.c
+++ b/erts/etc/common/dialyzer.c
@@ -147,6 +147,9 @@ main(int argc, char** argv)
env = get_env("DIALYZER_EMULATOR");
emulator = env ? env : get_default_emulator(argv[0]);
+ if (strlen(emulator) >= MAXPATHLEN)
+ error("Value of environment variable DIALYZER_EMULATOR is too large");
+
/*
* Allocate the argv vector to be used for arguments to Erlang.
* Arrange for starting to pushing information in the middle of
@@ -228,7 +231,7 @@ main(int argc, char** argv)
static void
push_words(char* src)
{
- char sbuf[1024];
+ char sbuf[MAXPATHLEN];
char* dst;
dst = sbuf;
@@ -360,7 +363,7 @@ error(char* format, ...)
va_list ap;
va_start(ap, format);
- vsprintf(sbuf, format, ap);
+ erts_vsnprintf(sbuf, sizeof(sbuf), format, ap);
va_end(ap);
fprintf(stderr, "dialyzer: %s\n", sbuf);
exit(1);
@@ -389,6 +392,9 @@ get_default_emulator(char* progname)
char sbuf[MAXPATHLEN];
char* s;
+ if (strlen(progname) >= sizeof(sbuf))
+ return ERL_NAME;
+
strcpy(sbuf, progname);
for (s = sbuf+strlen(sbuf); s >= sbuf; s--) {
if (IS_DIRSEP(*s)) {