Here's a patch for _getenv_r() so that it properly fails to make a match
if the given name contains an '='. (Otherwise it can erroneously
match an entry which has an = in the value.) The patch file contains
the
ChangeLog entry, too.
Craig Howland
The following program fragment demonstrates the problem being solved.
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
...
int ow=1;
const char *id, *val;
/* Tricky case */
id = "Craig";
val = "two=one";
ow = 1;
printf("setenv('%s','%s', %d) = %d\n", id, val, ow, setenv(id, val,
ow));
/* env now contains "Craig=two=one" */
printf("getenv('%s') = %s\n", id, getenv(id)); // Good match
id = "Craig=two";
printf("getenv('%s') = %s\n", id, getenv(id)); // Potential false match