Opened 19 years ago
Closed 19 years ago
#1197 closed defect (fixed)
msSetError doesn't zero terminate routine name
Reported by: | Owned by: | sdlime | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | MapServer C Library | Version: | 4.4 |
Severity: | major | Keywords: | |
Cc: | sgillies@… |
Description
If a routine name is longer then ROUTINELENGTH then msSetError fails to zero terminate it in the new errorObj object.
Attachments (1)
Change History (6)
by , 19 years ago
Attachment: | maperror.c.patch added |
---|
comment:2 by , 19 years ago
Cc: | added |
---|
comment:3 by , 19 years ago
I agree with the patch except that setting ms_error->routine[ROUTINELENGTH]='\0' will write one byte past the end of the buffer. The last byte in the buffer is at index ROUTINELENGTH-1, so the patch should become: Index: maperror.c =================================================================== RCS file: /data2/cvsroot/mapserver/maperror.c,v retrieving revision 1.61 diff -u -r1.61 maperror.c --- maperror.c 28 Jan 2005 06:16:53 -0000 1.61 +++ maperror.c 30 Jan 2005 18:38:04 -0000 @@ -295,8 +295,10 @@ if(!routine) strcpy(ms_error->routine, ""); - else + else { strncpy(ms_error->routine, routine, ROUTINELENGTH); + ms_error->routine[ROUTINELENGTH-1] = '\0'; + } if(!message_fmt) strcpy(ms_error->message, "");
comment:4 by , 19 years ago
Status: | new → assigned |
---|
Applied Dan's modified patch, thanks to both of you guys. Steve
Note:
See TracTickets
for help on using tickets.
maperror.c patch