Skip to content

Commit 31f4b06

Browse files
authored
Merge pull request #2324 from Mab879/fix_2323
Add null check for ns_uri in cpe_dict_detect_version_priv
2 parents 657a4ff + 121e50b commit 31f4b06

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/CPE/cpedict.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
* License as published by the Free Software Foundation; either
1515
* version 2.1 of the License, or (at your option) any later version.
1616
*
17-
* This library is distributed in the hope that it will be useful,
17+
* This library is distributed in the hope that it will be useful,
1818
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1919
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2020
* Lesser General Public License for more details.
2121
*
2222
* You should have received a copy of the GNU Lesser General Public
23-
* License along with this library; if not, write to the Free Software
23+
* License along with this library; if not, write to the Free Software
2424
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2525
*
2626
* Authors:
@@ -165,7 +165,7 @@ bool cpe_item_is_applicable(struct cpe_item* item, cpe_check_fn cb, void* usr)
165165
return ret;
166166
}
167167

168-
const char * cpe_dict_model_supported(void)
168+
const char * cpe_dict_model_supported(void)
169169
{
170170
return CPE_DICT_SUPPORTED;
171171
}
@@ -183,6 +183,10 @@ char *cpe_dict_detect_version_priv(xmlTextReader *reader)
183183
return NULL;
184184
}
185185
const char* ns_uri = (const char *) xmlTextReaderConstNamespaceUri(reader);
186+
if (ns_uri == NULL) {
187+
oscap_seterr(OSCAP_EFAMILY_OSCAP, "Expected namespace uri for cpe-list, found none.");
188+
return NULL;
189+
}
186190

187191
/* find generator */
188192
while (xmlTextReaderRead(reader) == 1

0 commit comments

Comments
 (0)