Download raw body.
relayd: missing NULL check for bsearch
Hi, following bsearch call in relay_httperror_byid is missing a NULL check. The fix uses the same pattern as the other bsearch call. Jan diff --git usr.sbin/relayd/relay_http.c usr.sbin/relayd/relay_http.c index 056cd076171..aefc6157f77 100644 --- usr.sbin/relayd/relay_http.c +++ usr.sbin/relayd/relay_http.c @@ -1388,11 +1388,12 @@ relay_httperror_byid(u_int id) /* Set up key */ error.error_code = (int)id; - res = bsearch(&error, http_errors, + if ((res = bsearch(&error, http_errors, sizeof(http_errors) / sizeof(http_errors[0]) - 1, - sizeof(http_errors[0]), relay_httperror_cmp); + sizeof(http_errors[0]), relay_httperror_cmp)) != NULL) + return (res->error_name); - return (res->error_name); + return NULL; }
relayd: missing NULL check for bsearch