diff options
author | Omar Polo <op@omarpolo.com> | 2021-01-27 15:35:09 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-01-27 15:35:09 +0000 |
commit | 44ee1bac8bc4ca2f216297d00ee6677f49fe3342 (patch) | |
tree | f5dd2f4d107eb8aade8d20f4e81c746f1b95064c /puny.c | |
parent | 22c6d6334deef920cd0212ca92f61d315860177a (diff) |
use starts_with in puny.c
Diffstat (limited to 'puny.c')
-rw-r--r-- | puny.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -142,11 +142,7 @@ decode(const char *str, char *out, size_t len) unsigned int numpoints; const char *s; - if (str == NULL || len <= 4) - return 0; - - /* todo: starts_with */ - if (strstr(str, "xn--") != str) { + if (!starts_with(str, "xn--")) { strncpy(out, str, len); return 1; } @@ -223,6 +219,8 @@ puny_decode(const char *hostname, char *out, size_t len) size_t l; memset(out, 0, len); + if (hostname == NULL) + return 1; s = hostname; for (;;) { |