From 530d87be1bec8514507782e045cef064e248a916 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 1 Jul 2014 12:26:15 +0200 Subject: [PATCH] pts: Use memchr(3) instead of strchr(3) to extract hash algorithm name The string read with read(2) might not be null terminated. --- src/libpts/pts/pts_ima_event_list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libpts/pts/pts_ima_event_list.c b/src/libpts/pts/pts_ima_event_list.c index a237451ca..9959fb3b3 100644 --- a/src/libpts/pts/pts_ima_event_list.c +++ b/src/libpts/pts/pts_ima_event_list.c @@ -252,7 +252,7 @@ pts_ima_event_list_t* pts_ima_event_list_create(char *file) } /* extract the hash algorithm name */ - pos = strchr(algo_digest, '\0'); + pos = memchr(algo_digest, '\0', algo_digest_len); if (!pos) { error = "no algo field";