Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#2589 closed defect (fixed)

Use of getenv() without checking for NULL in processLine()

Reported by: dmorissette Owned by: sdlime
Priority: normal Milestone: 5.2 release
Component: MapServer C Library Version: unspecified
Severity: normal Keywords:
Cc:

Description

processLine() in maptemplate.c uses getenv() to read some env. variables and uses the value without checking whether the returned value is NULL:

  snprintf(repstr, PROCESSLINE_BUFLEN, "%s", getenv("HTTP_HOST")); 
  outstr = msReplaceSubstring(outstr, "[host]", repstr);
  snprintf(repstr, PROCESSLINE_BUFLEN, "%s", getenv("SERVER_PORT"));
  outstr = msReplaceSubstring(outstr, "[port]", repstr);

Change History (3)

comment:1 by sdlime, 16 years ago

Status: newassigned

comment:2 by sdlime, 16 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r7632. Getenv() output doesn't need to be free'd does it?

Steve

comment:3 by dmorissette, 16 years ago

No, getenv() output doesn't need to be freed.

Note: See TracTickets for help on using tickets.