MCPcopy Create free account
hub / github.com/NetHack/NetHack / nh_getenv

Function nh_getenv

util/sfctool.c:877–886  ·  view source on GitHub ↗

duplicated code from options.c */ most environment variables will eventually be printed in an error * message if they don't work, and most error message paths go through * BUFSZ buffers, which could be overflowed by a maliciously long * environment variable. If a variable can legitimately be long, or * if it's put in a smaller buffer, the responsible code will have to * bounds-check itself.

Source from the content-addressed store, hash-verified

875 * bounds-check itself.
876 */
877char *
878nh_getenv(const char *ev)
879{
880 char *getev = getenv(ev);
881
882 if (getev && strlen(getev) <= (BUFSZ / 2))
883 return getev;
884 else
885 return (char *) 0;
886}
887
888void
889done1(int sig_unused UNUSED)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected