Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
Note that this example also violates rule \[[DCL30-C. DoDeclare notobjects referwith toappropriate an object outside of its lifetimestorage durations]\].

Code Block
bgColor#FFCCCC
int func(char *var) {
  char env[1024];

  if (snprintf(env, sizeof(env),"TEST=%s", var) < 0) {
    /* Handle Error */
  }

  return putenv(env);
}

...

Wiki Markup
\[[Open Group 04|AA. C++ References#Open Group 04]\] The putenv() function
\[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\] Section 6.2.4, "Storage durations of objects," and Section 7.20.3, "Memory management functions"
\[[Dowd|AA. C References#Dowd 06]\] Chapter 10, "UNIX Processes" (Confusing putenv() and setenv())
\[[DCL30-C. DoDeclare notobjects referwith toappropriate an object outside of its lifetimestorage durations]\]