unit-test: add language tag length validation

Ensure caller has provided enough language tag data to match with their
input length

Change-Id: Icc60601d19ee33a52413dd8f2b8462791571ebcb
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/test/slp_parser_test.cpp b/test/slp_parser_test.cpp
index 3615c93..338b214 100644
--- a/test/slp_parser_test.cpp
+++ b/test/slp_parser_test.cpp
@@ -40,3 +40,29 @@
 
     EXPECT_NE(rc, 0);
 }
+
+TEST(parseHeaderTest, ValidLangTagLength)
+{
+    // Language Tag Length that is valid
+    slp::buffer testData{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                         0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00};
+
+    slp::Message req;
+    int rc = slp::SUCCESS;
+    std::tie(rc, req) = slp::parser::internal::parseHeader(testData);
+
+    EXPECT_EQ(rc, 0);
+}
+
+TEST(parseHeaderTest, InvalidLangTagLength)
+{
+    // Language Tag Length that is too big
+    slp::buffer testData{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                         0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00};
+
+    slp::Message req;
+    int rc = slp::SUCCESS;
+    std::tie(rc, req) = slp::parser::internal::parseHeader(testData);
+
+    EXPECT_NE(rc, 0);
+}