From: Tobias Brunner Date: Tue, 1 Jul 2014 10:26:15 +0000 (+0200) Subject: pts: Use memchr(3) instead of strchr(3) to extract hash algorithm name X-Git-Tag: 5.2.0~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=530d87be1bec8514507782e045cef064e248a916;p=thirdparty%2Fstrongswan.git pts: Use memchr(3) instead of strchr(3) to extract hash algorithm name The string read with read(2) might not be null terminated. --- diff --git a/src/libpts/pts/pts_ima_event_list.c b/src/libpts/pts/pts_ima_event_list.c index a237451ca5..9959fb3b38 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";