diff options
author | Richard Levitte <levitte@openssl.org> | 2004-07-19 16:36:28 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2004-07-19 16:36:28 +0000 |
commit | 210a4f78ae78799f7dc8f4b115c3727eb2d24bd8 (patch) | |
tree | c7d809227ecc70c1665c0fc700fbc7294fdcb370 /crypto/LPdir_unix.c | |
parent | 334ef049492368c7eb032d507e571f41a3fed779 (diff) | |
download | openssl-new-210a4f78ae78799f7dc8f4b115c3727eb2d24bd8.tar.gz |
Imported from LPlib, making sure the entry name (at least on Unix) is
NUL-teminated at all times, and that we don't make unneeded calls to
free().
Diffstat (limited to 'crypto/LPdir_unix.c')
-rw-r--r-- | crypto/LPdir_unix.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/LPdir_unix.c b/crypto/LPdir_unix.c index 83686e8e78..7298a23ae6 100644 --- a/crypto/LPdir_unix.c +++ b/crypto/LPdir_unix.c @@ -1,4 +1,4 @@ -/* $LP: LPlib/source/LPdir_unix.c,v 1.6 2004/06/14 10:08:43 _cvs_levitte Exp $ */ +/* $LP: LPlib/source/LPdir_unix.c,v 1.8 2004/07/19 16:34:39 _cvs_levitte Exp $ */ /* * Copyright (c) 2004, Richard Levitte <richard@levitte.org> * All rights reserved. @@ -79,7 +79,8 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) return 0; } - strncpy((*ctx)->entry_name, direntry->d_name, sizeof((*ctx)->entry_name)); + strncpy((*ctx)->entry_name, direntry->d_name, sizeof((*ctx)->entry_name) - 1); + (*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0'; return (*ctx)->entry_name; } |