Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
Fix potential null deref with method logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Ellzey committed Apr 26, 2013
1 parent b99a1c6 commit d26ca8f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,17 @@ logger_log_request_tostr(logger_t * logger, request_t * request, evbuf_t * buf)
}
break;
case logger_argtype_meth:
/* log the method of the request */
evbuffer_add(buf, htparser_get_methodstr(upstream_c->parser),
strlen(htparser_get_methodstr(upstream_c->parser)));
break;
{
const char * methstr - htparser_get_methodstr(upstream_c->parser);

if (methstr != NULL) {
/* log the method of the request */
evbuffer_add(buf, methstr, strlen(methstr));
} else {
evbuffer_add(buf, "-", 1);
}
}
break;
case logger_argtype_uri:
/* log the URI requested by the upstream */
if (upstream_r->uri && upstream_r->uri->path &&
Expand Down

0 comments on commit d26ca8f

Please sign in to comment.