aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2012-08-30 16:56:43 +0200
committerPatrik Nyblom <[email protected]>2012-08-30 16:56:43 +0200
commit07905276ce951d59b400516f9a4601d376b383b9 (patch)
tree6d71721b74104d00ca61646a52a418e1753c6e4e /erts/emulator/drivers/common
parentda477e3fc1bcac8d8afb4d3eef6d250d4eae37e0 (diff)
parentcf6d1faf367b47c79ded23afc0d3fd3f38abfaea (diff)
downloadotp-07905276ce951d59b400516f9a4601d376b383b9.tar.gz
otp-07905276ce951d59b400516f9a4601d376b383b9.tar.bz2
otp-07905276ce951d59b400516f9a4601d376b383b9.zip
Merge branch 'pan/win_readlink/OTP-10200' into maint
* pan/win_readlink/OTP-10200: Teach VM not to dump core on long pathnames
Diffstat (limited to 'erts/emulator/drivers/common')
-rw-r--r--erts/emulator/drivers/common/efile_drv.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index f24098025e..912f5d3d8b 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -206,6 +206,9 @@ dt_private *get_dt_private(int);
# define KEY(desc) (&(desc)->key)
#endif
+#ifndef MAX
+# define MAX(x, y) (((x) > (y)) ? (x) : (y))
+#endif
#ifdef FILENAMES_16BIT
#ifdef USE_VM_PROBES
@@ -2848,8 +2851,9 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
case FILE_READLINK:
{
- d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 + RESBUFSIZE + 1);
-
+ d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 +
+ MAX(RESBUFSIZE, (FILENAME_BYTELEN(name) +
+ FILENAME_CHARSIZE)) + 1);
FILENAME_COPY(d->b, name);
#ifdef USE_VM_PROBES
dt_s1 = d->b;
@@ -2864,7 +2868,9 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
case FILE_ALTNAME:
{
- d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 + RESBUFSIZE + 1);
+ d = EF_SAFE_ALLOC(sizeof(struct t_data) - 1 +
+ MAX(RESBUFSIZE, (FILENAME_BYTELEN(name) +
+ FILENAME_CHARSIZE)) + 1);
FILENAME_COPY(d->b, name);
#ifdef USE_VM_PROBES
dt_s1 = d->b;