fix memory issue on empty string (issue 2) (patch from jefftk)
authorbmcquade <bmcquade@google.com>
Tue, 15 Apr 2014 15:22:56 +0000 (15:22 +0000)
committerbmcquade <bmcquade@google.com>
Tue, 15 Apr 2014 15:22:56 +0000 (15:22 +0000)
src/domain_registry/private/registry_search.c

index 0d3a1b6..9d0aadd 100644 (file)
@@ -124,7 +124,7 @@ static const char* GetNextHostnamePartImpl(const char* start,
      * Special case: a single trailing dot indicates a fully-qualified
      * domain name. Skip over it.
      */
-     if (*(end - 1) == 0) {
+    if (end > start && *(end - 1) == sep) {
       *ctx = (void*) (end - 1);
     }
   }