[mod_cml,mod_flv_streaming] fix NULL ptr deref

fix possible NULL pointer dereference when query string not present
and no previous query strings processed by that specific connection
instance

regression in lighttpd 1.4.51 (mod_flv_streaming)
regression in lighttpd 1.4.52 (mod_cml)

workaround for mod_flv_streaming:
  url.rewrite-once = ( "\.flv$" => "${url.path}?" )
(similar workaround for mod_cml)

(thx fab)

x-ref:
  "segfault with mod_flv_streaming"
  https://redmine.lighttpd.net/boards/2/topics/8404
This commit is contained in:
Glenn Strauss 2018-12-02 00:50:33 -05:00
parent 53c231a764
commit 685f4ed62c
2 changed files with 2 additions and 0 deletions

View File

@ -67,6 +67,7 @@ static int cache_export_get_params(lua_State *L, int tbl, buffer *qrystr) {
size_t i, len, klen = 0;
char *key = NULL, *val = NULL;
if (buffer_string_is_empty(qrystr)) return 0;
key = qrystr->ptr;
/* we need the \0 */

View File

@ -121,6 +121,7 @@ static int split_get_params(array *get_params, buffer *qrystr) {
size_t is_key = 1, klen = 0;
char *key = qrystr->ptr, *val = NULL;
if (buffer_string_is_empty(qrystr)) return 0;
for (size_t i = 0, len = buffer_string_length(qrystr); i <= len; ++i) {
switch(qrystr->ptr[i]) {
case '=':