Skip to content

Commit

Permalink
Additional checks against crashes in the is_local_hostname()
Browse files Browse the repository at this point in the history
  • Loading branch information
tillkamppeter committed Feb 18, 2020
1 parent 72052da commit 4157690
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions NEWS
@@ -1,6 +1,11 @@
NEWS - OpenPrinting CUPS Filters v1.27.1 - 2020-02-16
-----------------------------------------------------

CHANGES IN V1.27.2

- cups-browsed: Additional checks against crashes in the
is_local_hostname() function (Ubuntu bug #1863716)

CHANGES IN V1.27.1

- libcupsfilters: Let the PPD generator not put any dashes
Expand Down
8 changes: 6 additions & 2 deletions utils/cups-browsed.c
Expand Up @@ -9134,13 +9134,17 @@ int
is_local_hostname(const char *host_name) {
char *host;

if (host_name == NULL)
return 0;

for (host = (char *)cupsArrayFirst (local_hostnames);
host != NULL;
host = (char *)cupsArrayNext (local_hostnames))
if (strncasecmp(host_name, host, strlen(host)) == 0 &&
(strlen(host_name) == strlen(host) ||
strcasecmp(host_name + strlen(host), ".local") == 0 ||
strcasecmp(host_name + strlen(host), ".local.") == 0))
(strlen(host_name) > strlen(host) &&
(strcasecmp(host_name + strlen(host), ".local") == 0 ||
strcasecmp(host_name + strlen(host), ".local.") == 0))))
return 1;

return 0;
Expand Down

0 comments on commit 4157690

Please sign in to comment.