summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Thomson <martin.thomson@gmail.com>2016-04-21 21:07:47 +1000
committerMartin Thomson <martin.thomson@gmail.com>2016-04-21 21:07:47 +1000
commitcd005a9be82506116a28191dc5e67651aaff3342 (patch)
tree12153c9982457547e9f3f3e77a7e66a6fb21e6be
parentd723525c987386f368911dd2572490b2417f8d21 (diff)
downloadnss-hg-cd005a9be82506116a28191dc5e67651aaff3342.tar.gz
Bug 1254334 - Include headers recommended for SunOS and readdir, a=bustage
-rw-r--r--lib/freebl/unix_rand.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/freebl/unix_rand.c b/lib/freebl/unix_rand.c
index d773b193b..956584920 100644
--- a/lib/freebl/unix_rand.c
+++ b/lib/freebl/unix_rand.c
@@ -12,6 +12,8 @@
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
#include "secrng.h"
#include "secerr.h"
#include "prerror.h"
@@ -1094,9 +1096,9 @@ ReadOneFile(int fileToRead)
name = entry->d_name;
if (i == 0) {
/* copy the name of the first in case we run out of entries */
- PORT_Assert(PORT_Strlen(name) <= NAME_MAX);
- PORT_Strncpy(firstName, name, NAME_MAX);
- firstName[NAME_MAX] = '\0';
+ PORT_Assert(PORT_Strlen(name) < sizeof(firstName));
+ PORT_Strncpy(firstName, name, sizeof(firstName) - 1);
+ firstName[sizeof(firstName) - 1] = '\0';
}
}