Browse Source

[2383] Check the constructor gets some data

It is invalid input if no data is passed.
Michal 'vorner' Vaner 12 years ago
parent
commit
0be210a2f5
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/lib/dns/name.cc

+ 5 - 0
src/lib/dns/name.cc

@@ -322,6 +322,11 @@ Name::Name(const std::string &namestring, bool downcase) {
 }
 
 Name::Name(const char* namedata, size_t data_len, const Name*, bool downcase) {
+    // Check validity of data
+    if (namedata == NULL || data_len == 0) {
+        isc_throw(isc::InvalidParameter,
+                  "No data provided to Name constructor");
+    }
     // Prepare inputs for the parser
     const char* end = namedata + data_len;