Permalink
Browse files

"Pointer 'file' returned from call to function 'strrchr' at line 581

may be NULL and will be dereferenced at line 583." (Klocwork.com Issue

git-svn-id: svn://cherokee-project.com/cherokee/trunk@6666 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
1 parent ecefbcb commit 1c4742ac45c995543035e18fb283589c943e7f56 @alobbs alobbs committed May 21, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −3 cherokee/handler_cgi.c
View
@@ -580,9 +580,13 @@ manage_child_cgi_process (cherokee_handler_cgi_t *cgi, int pipe_cgi[2], int pipe
} else {
char *file = strrchr (absolute_path, '/');
- *file = '\0';
- re = chdir (absolute_path);
- *file = '/';
+ if (file != NULL) {
+ *file = '\0';
+ re = chdir (absolute_path);
+ *file = '/';
+ } else {
+ re = -1;
+ }
}
if (re < 0) {

0 comments on commit 1c4742a

Please sign in to comment.