This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, libgfortran] PR 61035 Stack overflow in GETCWD


Hello,

the attached patch avoids a stack overflow crash due to not trying to
create a null-terminated duplicate of the argument char array on the
stack. Also, for the common case it avoids an extra allocation and an
extra memcpy.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk?

2014-05-03  Janne Blomqvist  <jb@gcc.gnu.org>

    PR libfortran/61035
    * intrinsics/getcwd.c (getcwd_i4_sub): Avoid potentially large
    stack allocation, avoid extra copying in the common case.


-- 
Janne Blomqvist

Attachment: getcwd.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]