diff options
author | Henrik Nord <[email protected]> | 2011-09-08 16:36:26 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-09-08 16:36:26 +0200 |
commit | f602ae4f0c727c1ff37e69887ba33f46b24c54e1 (patch) | |
tree | 340525e4b69e6971854de896b4f64d70b2224b0a /lib/erl_interface/src/encode/encode_string.c | |
parent | 6fae573fc291f4a77282b918cae346064bece80e (diff) | |
parent | 262a9af33d3ceb4cb032c434b100cea7d4b0d60e (diff) | |
download | otp-f602ae4f0c727c1ff37e69887ba33f46b24c54e1.tar.gz otp-f602ae4f0c727c1ff37e69887ba33f46b24c54e1.tar.bz2 otp-f602ae4f0c727c1ff37e69887ba33f46b24c54e1.zip |
Merge branch 'dev' into major
Diffstat (limited to 'lib/erl_interface/src/encode/encode_string.c')
-rw-r--r-- | lib/erl_interface/src/encode/encode_string.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/erl_interface/src/encode/encode_string.c b/lib/erl_interface/src/encode/encode_string.c index 1d342cb605..593bbf2b6d 100644 --- a/lib/erl_interface/src/encode/encode_string.c +++ b/lib/erl_interface/src/encode/encode_string.c @@ -17,6 +17,7 @@ * %CopyrightEnd% */ #include <string.h> +#include <limits.h> #include "eidef.h" #include "eiext.h" #include "putget.h" @@ -24,7 +25,10 @@ int ei_encode_string(char *buf, int *index, const char *p) { - return ei_encode_string_len(buf, index, p, strlen(p)); + size_t len = strlen(p); + + if (len >= INT_MAX) return -1; + return ei_encode_string_len(buf, index, p, len); } int ei_encode_string_len(char *buf, int *index, const char *p, int len) |