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

Check that whole locking_dir fits _lock_dir buffer

This commit is contained in:
Zdenek Kabelac 2012-02-08 11:17:34 +00:00
parent 1a39fa0073
commit 0154bcf0a7
2 changed files with 10 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.91 -
===================================
Check that whole locking_dir fits _lock_dir buffer in init_file_locking().
Use list functions for label_exit().
Ensure strncpy() function always ends with '\0'.
Set status in _fsadm_cmd() for error path.

View File

@ -337,6 +337,7 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd,
int suppress_messages)
{
int r;
const char *locking_dir;
locking->lock_resource = _file_lock_resource;
locking->reset_locking = _reset_file_locking;
@ -344,9 +345,14 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd,
locking->flags = 0;
/* Get lockfile directory from config file */
strncpy(_lock_dir, find_config_tree_str(cmd, "global/locking_dir",
DEFAULT_LOCK_DIR),
sizeof(_lock_dir));
locking_dir = find_config_tree_str(cmd, "global/locking_dir",
DEFAULT_LOCK_DIR);
if (strlen(locking_dir) >= sizeof(_lock_dir)) {
log_error("Path for locking_dir %s is invalid.", locking_dir);
return 0;
}
strcpy(_lock_dir, locking_dir);
_prioritise_write_locks =
find_config_tree_bool(cmd, "global/prioritise_write_locks",