Jump to content
mohitnegi

error in systemc.h 118:16 error std::gets is not declared using std::gets

Recommended Posts

hi ,

I have updated my gcc compiler to 4.9 version . now when I compile my system C model

with g++14 compiler option enabled ,it is giving this error in systemC header file

systemc.h 118:16 error std::gets is not declared using std::gets

 

I was not getting this error earlier . I tried building my systemC library with ./configure CXX=g++-4.9

but the same issue comes up ..

can anyone help in this ??

Share this post


Link to post
Share on other sites

FYI,  I had errors when running "gmake check" as part of my build/install of systemc-2.3.1a.  I modified './src/systemc.h' line 120 from "using std::gets" to "using std::fgets".  The "gmake check" did complete execution after I made this change.  Although other warnings were thrown.  I am using gcc 4.8.5 that has g++ version 6.2.1 20160826  (openSUSE Leap 42.2 x86_64).

Share this post


Link to post
Share on other sites

Observation: gets() is now considered forbidden in C since it is the cause of many hack attacks to create buffer overflow. get_s is recommended because it puts an upper limit on the number of acceptable characters. Although C++ std::string can handle large strings, it could still be an issue.

I am not saying you should never use it, but please be aware. I realize our SystemC activities are usually confined to safe internal use only situations, but I can forsee examples on the open web that might lead to an issue.

[Note: I teach C/C++ security courses in addition to my SystemC activities..]

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...