/*********************************************************
- * Copyright (C) 2011-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2011-2016,2018 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* This is a legacy function that has some issues, but setting up a bio
* just for a bit of debug seems overkill.
*/
- X509_NAME_oneline(X509_get_subject_name(curCert), nameBuf, sizeof(nameBuf) - 1);
- nameBuf[sizeof(nameBuf)-1] = '\0';
+ if (NULL != curCert) {
+ X509_NAME_oneline(X509_get_subject_name(curCert), nameBuf, sizeof(nameBuf) - 1);
+ nameBuf[sizeof(nameBuf)-1] = '\0';
+ } else {
+ g_strlcpy(nameBuf, "<NO CERT SUBJECT>", sizeof nameBuf);
+ }
g_debug("%s: name: %s ok: %d error %d at %d depth lookup:%s\n",
__FUNCTION__,
nameBuf,