c53997720b231ad61af435a3124c7ecd731fc99b |
|
13-Feb-2018 |
Lukas Slebodnik <lslebodn@redhat.com> |
INOTIFY: Fix warning Wstringop-truncation
It could not cause any security bug because it is used only with short
names /etc/passwd, /etc/group, /etc/resolv.conf.
And only root could set long names via env variables
SSS_FILES_PASSWD, SSS_FILES_GROUP
CC src/util/libsss_files_la-inotify.lo
src/util/inotify.c: In function ‘copy_filenames’:
src/util/inotify.c:390:5: warning: ‘strncpy’ specified bound 4096
equals destination size [-Wstringop-truncation]
strncpy(fcopy, filename, sizeof(fcopy));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sssd/src/util/inotify.c:403:5: warning: ‘strncpy’ specified bound
4096 equals destination size [-Wstringop-truncation]
strncpy(fcopy, filename, sizeof(fcopy));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
man gcc says:
In the following example, the call to "strncpy" specifies the size
of the destination buffer as the bound. If the length of the
source string is equal to or greater than this size the result of
the copy will not be NUL-terminated. Therefore, the call is also
diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
bound and set the last element of the buffer to "NUL".
void copy (const char *s)
{
char buf[80];
strncpy (buf, s, sizeof buf);
...
}
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> |
8cfb42e1985550e99585d311f68087d414932806 |
|
15-Feb-2017 |
Jakub Hrozek <jhrozek@redhat.com> |
UTIL: Add a generic inotify module
Adds a reusable module for watching files using the Linux-specific
inotify(7) interface. Adds the possibility to watch the file's parent
directory as well to make it possible to watch moves into the directory
and allow watching file that doesn't exist at the time the watch is
created.
This interface is needed to implement the files provider, so this commit
is related to:
https://fedorahosted.org/sssd/ticket/2228
Reviewed-by: Pavel Březina <pbrezina@redhat.com> |