PERFORCE change 1192820 for review
Christian Brueffer
brueffer at FreeBSD.org
Mon Apr 14 22:33:00 UTC 2014
http://p4web.freebsd.org/@@1192820?ac=10
Change 1192820 by brueffer at brueffer_freefall on 2014/04/14 22:32:54
Check readlink() return value; auditd_expire_trails() may return ADE_READLINK
now.
While here, fix a comment typo.
Affected files ...
.. //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#19 edit
Differences ...
==== //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#19 (text+ko) ====
@@ -26,7 +26,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#18 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#19 $
*/
#include <sys/param.h>
@@ -402,12 +402,13 @@
* ADE_NOERR on success or there is nothing to do.
* ADE_PARSE if error parsing audit_control(5).
* ADE_NOMEM if could not allocate memory.
- * ADE_EXPIRE if there was an unespected error.
+ * ADE_READLINK if could not read link file.
+ * ADE_EXPIRE if there was an unexpected error.
*/
int
auditd_expire_trails(int (*warn_expired)(char *))
{
- int andflg, ret = ADE_NOERR;
+ int andflg, len, ret = ADE_NOERR;
size_t expire_size, total_size = 0L;
time_t expire_age, oldest_time, current_time = time(NULL);
struct dir_ent *traildir;
@@ -431,7 +432,9 @@
* Read the 'current' trail file name. Trim off directory path.
*/
activefn[0] = '\0';
- readlink(AUDIT_CURRENT_LINK, activefn, MAXPATHLEN - 1);
+ len = readlink(AUDIT_CURRENT_LINK, activefn, MAXPATHLEN - 1);
+ if (len < 0)
+ return (ADE_READLINK);
if ((afnp = strrchr(activefn, '/')) != NULL)
afnp++;
More information about the p4-projects
mailing list