Browse Source

[2387] Fix empty bitmap case

Mukund Sivaraman 12 years ago
parent
commit
947d85d0e8
1 changed files with 10 additions and 3 deletions
  1. 10 3
      src/lib/dns/rdata/generic/nsec3_50.cc

+ 10 - 3
src/lib/dns/rdata/generic/nsec3_50.cc

@@ -111,15 +111,22 @@ NSEC3::constructFromLexer(MasterLexer& lexer) {
     }
 
     // For NSEC3 empty bitmap is possible and allowed.
-    if (lexer.getNextToken().getType() == MasterToken::END_OF_FILE) {
+    bool empty_bitmap = false;
+    const MasterToken token = lexer.getNextToken();
+    if ((token.getType() == MasterToken::END_OF_LINE) ||
+        (token.getType() == MasterToken::END_OF_FILE)) {
+         empty_bitmap = true;
+    }
+
+    lexer.ungetToken();
+
+    if (empty_bitmap) {
         impl_ = new NSEC3Impl(params.algorithm, params.flags,
                               params.iterations, salt, next,
                               vector<uint8_t>());
         return;
     }
 
-    lexer.ungetToken();
-
     vector<uint8_t> typebits;
     buildBitmapsFromLexer("NSEC3", lexer, typebits);