fix size computation
This commit is contained in:
parent
6c8a901940
commit
1ff2e9944e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux32_dirent.c,v 1.14 2017/01/13 21:02:05 christos Exp $ */
|
||||
/* $NetBSD: linux32_dirent.c,v 1.15 2017/01/28 15:08:06 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux32_dirent.c,v 1.14 2017/01/13 21:02:05 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux32_dirent.c,v 1.15 2017/01/28 15:08:06 christos Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -215,9 +215,9 @@ again:
|
|||
idb.d_off = (linux32_off_t)off;
|
||||
idb.d_reclen = (u_short)linux32_reclen;
|
||||
}
|
||||
memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
|
||||
bdp->d_namlen));
|
||||
idb.d_name[strlen(idb.d_name) + 1] = bdp->d_type;
|
||||
size_t l = MIN(sizeof(idb.d_name) - 2, bdp->d_namlen + 1);
|
||||
memcpy(idb.d_name, bdp->d_name, l);
|
||||
idb.d_name[l + 1] = bdp->d_type;
|
||||
if ((error = copyout((void *)&idb, outp, linux32_reclen)))
|
||||
goto out;
|
||||
/* advance past this real entry */
|
||||
|
|
Loading…
Reference in New Issue