From 0eeec32ee3f63dcd0d945b537e820ee1b56ebeb3 Mon Sep 17 00:00:00 2001 From: Tim Ruehsen Date: Fri, 30 May 2014 16:08:47 +0200 Subject: [PATCH 1/2] fix return value of psl_builtin() to NULL if no builtin PSL data available --- src/psl.c | 4 ++++ tools/psl.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/psl.c b/src/psl.c index 5333020..77ed564 100644 --- a/src/psl.c +++ b/src/psl.c @@ -557,7 +557,11 @@ void psl_free(psl_ctx_t *psl) */ const psl_ctx_t *psl_builtin(void) { +#ifdef WITH_BUILTIN return &_builtin_psl; +#else + return NULL; +#endif } /** diff --git a/tools/psl.c b/tools/psl.c index 718e97e..841340c 100644 --- a/tools/psl.c +++ b/tools/psl.c @@ -90,7 +90,8 @@ int main(int argc, const char *const *argv) fprintf(stderr, "Dropped data from %s\n", psl_file); psl_file = NULL; } - psl = (psl_ctx_t *) psl_builtin(); + if (!(psl = (psl_ctx_t *) psl_builtin())) + printf("No builtin PSL data available\n"); } else if (!strcmp(*arg, "--load-psl-file") && arg < argv + argc - 1) { psl_free(psl); @@ -118,6 +119,11 @@ int main(int argc, const char *const *argv) break; } + if (!psl && mode != 99) { + printf("No PSL data available - aborting\n"); + exit(2); + } + if (mode == 1) { for (; arg < argv + argc; arg++) printf("%s: %d\n", *arg, psl_is_public_suffix(psl, *arg)); @@ -135,7 +141,7 @@ int main(int argc, const char *const *argv) printf("%s: %d\n", *arg, psl_is_cookie_domain_acceptable(psl, *arg, cookie_domain)); } else if (mode == 99) { - if (psl != psl_builtin()) { + if (psl && psl != psl_builtin()) { printf("suffixes: %d\n", psl_suffix_count(psl)); printf("exceptions: %d\n", psl_suffix_exception_count(psl)); } From 57b53c990cb82a1a028fddffee7230081279ec23 Mon Sep 17 00:00:00 2001 From: Tim Ruehsen Date: Fri, 30 May 2014 17:18:59 +0200 Subject: [PATCH 2/2] Release V0.2.4 --- NEWS | 3 +++ configure.ac | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 9d7a431..c54d3c8 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ Copyright (C) 2014 Tim Ruehsen +30.05.2014 + * Fixed psl_builtin() to return NULL if no built-in PSL data is available + 27.05.2014 Release V0.2.3 * changed API version to 0.2 diff --git a/configure.ac b/configure.ac index 8615f71..e87579b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ -AC_INIT([libpsl], [0.2.3], [tim.ruehsen@gmx.de], [libpsl], [http://github.com/rockdaboot/libpsl]) +AC_INIT([libpsl], [0.2.4], [tim.ruehsen@gmx.de], [libpsl], [http://github.com/rockdaboot/libpsl]) AC_PREREQ([2.59]) AM_INIT_AUTOMAKE([1.10 -Wall no-define]) @@ -63,7 +63,7 @@ AS_IF([ test "$enable_man" != no ], [ # 4. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0. # 5. If any interfaces have been added since the last public release, then increment age. # 6. If any interfaces have been removed or changed since the last public release, then set age to 0. -AC_SUBST([LIBPSL_SO_VERSION], [0:3:0]) +AC_SUBST([LIBPSL_SO_VERSION], [0:4:0]) AC_SUBST([LIBPSL_API_VERSION], [0.2]) # Check for idn2