Skip to content

Commit

Permalink
Fix segfault when no service is set in netcam_url ( redone , fixing p…
Browse files Browse the repository at this point in the history
…ast problem)
  • Loading branch information
AngelCarpintero authored and AngelCarpintero committed Jul 14, 2006
1 parent 391c384 commit de2a30b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions netcam.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static void netcam_url_parse(struct url_t *parse_url, const char *text_url)
}
}
}
if (!parse_url->port) {
if ((!parse_url->port) && (parse_url->service)){
if (!strcmp(parse_url->service, "http"))
parse_url->port = 80;
else if (!strcmp(parse_url->service, "ftp"))
Expand Down Expand Up @@ -1869,14 +1869,13 @@ int netcam_start(struct context *cnt)
netcam->connect_port = url.port;
}


if (!strcmp(url.service, "http")) {
if ((url.service) && (!strcmp(url.service, "http")) ){
retval = netcam_setup_html(netcam, &url);
} else if (!strcmp(url.service, "ftp")) {
} else if ((url.service) && (!strcmp(url.service, "ftp")) ){
retval = netcam_setup_ftp(netcam, &url);
} else {
motion_log(LOG_ERR, 0, "Invalid netcam service '%s' - "
"must be http or ftp", url.service);
"must be http or ftp", url.service);
netcam_url_free(&url);
return -1;
}
Expand Down

0 comments on commit de2a30b

Please sign in to comment.