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

Limit sscanf params with size

Make sure parsed string fits given char buffer.
This commit is contained in:
Zdenek Kabelac 2012-02-23 22:50:50 +00:00
parent d0a3aa04c8
commit 71f3bbd53f
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.94 -
====================================
Limit sscanf parameters with buffer size in clvmd get_initial_state().
Use const lv pointer for lv_is_active...() functions.
Use same signed numbers in _mirrored_transient_status().
Integrate client-side lvmetad into build.

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@ -729,7 +729,7 @@ static int get_initial_state(struct dm_hash_table *excl_uuid)
}
while (fgets(line, sizeof(line), lvs)) {
if (sscanf(line, "%s %s %s %s\n", vg, lv, flags, vg_flags) == 4) {
if (sscanf(line, "%64s %64s %25s %25s\n", vg, lv, flags, vg_flags) == 4) {
/* States: s:suspended a:active S:dropped snapshot I:invalid snapshot */
if (strlen(vg) == 38 && /* is is a valid UUID ? */