Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#13 segfault during initialization

closed-fixed
None
5
2009-07-09
2009-07-07
Anonymous
No

When started using Fedora Core 10 "service" minidlna segfaults. The reason is that the "service" utility clears all environment variables for security reasons prior to executing the daemon, including the environment var $LOGNAME. During init the function getfriendlyname() gets called which tries to strcat $LOGNAME to the friendly string (minidlna.c revision 1.39 line 186) Since it's cleared getenv() will return a NULL pointer causing a segmentation fault in strcat()

Proposed fix: - check for NULL return of getenv() before using it.
- use getpwuid(getuid()) instead of getenv("LOGNAME")
User workaround: set LOGNAME to some value before executing minidlna

Possible second problem: getfriendlyname() is called even if a friendly name is already supplied in the config file. Is this correct?

Discussion

  • Justin Maggard
    Justin Maggard
    2009-07-09

    • assigned_to: nobody --> jmaggard
    • status: open --> closed-fixed
     
  • Justin Maggard
    Justin Maggard
    2009-07-09

    Thanks for the info! It should be fixed in CVS. It should be harmless for getfriendlyname() to be called even when one is specified in the config file.