1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: search for delimiter in bounded buffer

This commit is contained in:
Zdenek Kabelac 2024-08-09 13:13:03 +02:00
parent aa75e1f0bf
commit a06a49b549

View File

@ -717,9 +717,10 @@ struct KMsg : Source {
unsigned long t;
time_t tt;
size_t len;
const char *delimiter = strchr(buf, ';');
const char *delimiter;
buf[ *sz ] = 0;
delimiter = strchr(buf, ';');
if ( sscanf( buf, "%u,%u,%lu,-%n", &level, &num, &t, &pos) == 3 ) {
if ( delimiter++ && ( delimiter - buf ) > pos )