$OpenBSD: patch-src_cvecheck_c,v 1.1.1.1 2013/03/08 09:54:49 ajacoutot Exp $

commit 3c4a47697276593a759e58070c25c59f695c2b3f
Author: Sven Vermeulen <sven.vermeulen@siphos.be>
Date:   Mon Feb 4 20:38:42 2013 +0100
Do not assume that there is (no) trailing content

--- src/cvecheck.c.orig	Sun Nov 25 22:00:21 2012
+++ src/cvecheck.c	Tue Mar  5 11:50:37 2013
@@ -116,9 +116,19 @@ void string_to_cpe(struct cpe_data * cpe, char * buffe
 		return;
 	}
 
-	fieldwidth = swstrlen(nextpos+1);
-	strncpy(cpe->language, nextpos+1, fieldwidth);
-	cpe->language[fieldwidth] = '\0';
+	cpos = nextpos+1;
+	nextpos = strchr(cpos, ':');
+	if (nextpos != NULL) {
+		fieldwidth = swstrlen(cpos) - swstrlen(nextpos);
+		strncpy(cpe->language, cpos, fieldwidth);
+		cpe->language[fieldwidth] = '\0';
+	} else {
+		strncpy(cpe->language, cpos, swstrlen(cpos));
+		cpe->language[swstrlen(cpos)] = '\0';
+		cpe->language[0] = '\0';
+		
+		return;
+	}
 };
 
 int copy_cpe(struct cpe_data * target, struct cpe_data * source) {
