chaps: Protect against bad argument to C_GetFunctionList

BUG=None
TEST=Chaps unit tests (with ASAN) plus PKCS11 tests

Change-Id: I185250fd209e2233159d3edef75aec815e3d64fe
Reviewed-on: https://chromium-review.googlesource.com/221934
Reviewed-by: Darren Krahn <dkrahn@chromium.org>
Commit-Queue: David Drysdale <drysdale@google.com>
Tested-by: David Drysdale <drysdale@google.com>
diff --git a/chaps/chaps.cc b/chaps/chaps.cc
index 077323d..c94e03c 100644
--- a/chaps/chaps.cc
+++ b/chaps/chaps.cc
@@ -183,6 +183,7 @@
 
 // PKCS #11 v2.20 section 11.4 page 106.
 CK_RV C_GetFunctionList(CK_FUNCTION_LIST_PTR_PTR ppFunctionList) {
+  LOG_CK_RV_AND_RETURN_IF(!ppFunctionList, CKR_ARGUMENTS_BAD);
   static CK_VERSION version = {2, 20};
   static CK_FUNCTION_LIST functionList = {
     version,