Menu

#148 Custom 'syslog.id' and openlog

cppcms-v1.0.x
closed
nobody
None
1
2017-02-25
2017-02-24
Anonymous
No

For any reason, if user needs to specify custom syslog.id value; CppCMS is
calling 'openlog' function with id variable stored on the stack.

According to
* this man page: https://linux.die.net/man/3/openlog,
* and this Debian bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=102350
'openlog' is free to use given 'ident' pointer as-is (without making copy of it).

Even on my Ubuntu 16.04 system, openlog is not copying given ident value.

In the current code, CppCMS is reading 'syslog.id' value from configuration into a std::string which is allocated from the stack. Then it passes string's c_str buffer to openlog. But when the code reaches to the end of block; that std::string will be destructed and the pointer passed to openlog will be invalidated.

Regards.

Discussion

  • Artyom Beilis

    Artyom Beilis - 2017-02-25
    • status: open --> closed
     
  • Artyom Beilis

    Artyom Beilis - 2017-02-25

    Fixed in cs 2415 in trunk

     

Anonymous
Anonymous

Add attachments
Cancel