Fix Coverity CID 1019054 (String not null terminated) in setfacl.
Increase the size of buf[] by one to allow room for a NUL character at the end. Reported by: Coverity CID: 1019054 MFC after: 1 week
This commit is contained in:
parent
5912ca59b0
commit
b1b73fc4c9
@ -43,7 +43,7 @@ acl_t
|
|||||||
get_acl_from_file(const char *filename)
|
get_acl_from_file(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ+1];
|
||||||
|
|
||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
err(1, "(null) filename in get_acl_from_file()");
|
err(1, "(null) filename in get_acl_from_file()");
|
||||||
@ -61,7 +61,7 @@ get_acl_from_file(const char *filename)
|
|||||||
err(1, "fopen() %s failed", filename);
|
err(1, "fopen() %s failed", filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(buf, sizeof(buf), (size_t)1, file);
|
fread(buf, sizeof(buf) - 1, (size_t)1, file);
|
||||||
if (ferror(file) != 0) {
|
if (ferror(file) != 0) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
err(1, "error reading from %s", filename);
|
err(1, "error reading from %s", filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user