Skip to content
Browse files

Implements an extra check after cherokee_avl_get_ptr where the return…

… value is used.

git-svn-id: svn://cherokee-project.com/cherokee/trunk@6822 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
1 parent d189480 commit 8507a571874ab7b6ee9a2fe0b4f6c9504953571e @skinkie skinkie committed Aug 21, 2011
View
5 cherokee/admin_server.c
@@ -424,8 +424,9 @@ cherokee_admin_server_reply_kill_source (cherokee_handler_t *hdl,
return ret_ok;
}
- if ((source->type != source_interpreter) ||
- ((source->type == source_interpreter) && (SOURCE_INT(source)->pid <= 1)))
+ if ((source != NULL) &&
+ ((source->type != source_interpreter) ||
+ ((source->type == source_interpreter) && (SOURCE_INT(source)->pid <= 1))))
{
cherokee_dwriter_dict_open (dwriter);
cherokee_dwriter_cstring (dwriter, "source");
View
2 cherokee/connection.c
@@ -1689,7 +1689,7 @@ get_encoding (cherokee_connection_t *conn,
ret = cherokee_avl_get_ptr (encoders_accepted, i1, (void **)&props);
*i2 = tmp; /* (2') */
- if (ret == ret_ok) {
+ if ((ret == ret_ok) && (props != NULL)) {
if (props->perms == cherokee_encoder_allow) {
/* Use encoder
*/
View
2 cherokee/handler_dirlist.c
@@ -624,7 +624,7 @@ cherokee_handler_dirlist_new (cherokee_handler_t **hdl, void *cnt, cherokee_modu
n->sort = Name_Down;
ret = cherokee_avl_get_ptr (HANDLER_CONN(n)->arguments, "order", (void **) &value);
- if (ret == ret_ok) {
+ if ((ret == ret_ok) && (value != NULL) && (value->len > 0)) {
if (value->buf[0] == 'N') n->sort = Name_Up;
else if (value->buf[0] == 'n') n->sort = Name_Down;
else if (value->buf[0] == 'D') n->sort = Date_Up;
View
6 cherokee/handler_post_report.c
@@ -142,11 +142,11 @@ _figure_x_progress_id (cherokee_connection_t *conn,
}
ret = cherokee_avl_get_ptr (conn->arguments, "X-Progress-ID", (void **)id);
- if ((ret != ret_ok) || (*id == NULL) || ((*id)->len <= 0)) {
- return ret_error;
+ if ((ret == ret_ok) && (*id != NULL) && ((*id)->len > 0)) {
+ return ret_ok;
}
- return ret_ok;
+ return ret_error;
}
ret_t
View
2 cherokee/handler_streaming.c
@@ -438,7 +438,7 @@ cherokee_handler_streaming_init (cherokee_handler_streaming_t *hdl)
ret = cherokee_connection_parse_args (conn);
if (ret == ret_ok) {
ret = cherokee_avl_get_ptr (conn->arguments, "start", (void **) &value);
- if (ret == ret_ok && value && value->len > 0) {
+ if ((ret == ret_ok) && (value != NULL) && (value->len > 0)) {
/* Set the starting point
*/
if (is_flv) {
View
5 cherokee/plugin_loader.c
@@ -460,6 +460,9 @@ cherokee_plugin_loader_get_info (cherokee_plugin_loader_t *loader,
ret = cherokee_avl_get_ptr (&loader->table, modname, (void **)&entry);
if (ret != ret_ok)
return ret;
+
+ if (entry == NULL)
+ return ret_error;
*info = entry->info;
return ret_ok;
@@ -485,7 +488,7 @@ cherokee_plugin_loader_get_sym (cherokee_plugin_loader_t *loader,
/* Even if we're trying to look for symbols in the executable,
* using dlopen(NULL), the handler pointer should not be nil.
*/
- if (entry->dlopen_ref == NULL)
+ if ((entry == NULL) || (entry->dlopen_ref == NULL))
return ret_not_found;
tmp = get_sym_from_dlopen_handler (entry->dlopen_ref, name);
View
2 cherokee/post_track.c
@@ -97,7 +97,7 @@ _figure_x_progress_id (cherokee_connection_t *conn,
ret = cherokee_connection_parse_args (conn);
if (ret == ret_ok) {
ret = cherokee_avl_get_ptr (conn->arguments, "X-Progress-ID", (void **)&tmp);
- if ((ret == ret_ok) && (tmp->len > 0)) {
+ if ((ret == ret_ok) && (tmp != NULL) && (tmp->len > 0)) {
cherokee_buffer_add_buffer (track_id, tmp);
TRACE (ENTRIES, "X-Progress-ID in query-string: '%s'\n", track_id->buf);

0 comments on commit 8507a57

Please sign in to comment.
Something went wrong with that request. Please try again.