Commit graph

15 commits

Author SHA1 Message Date
Rich Salz
16f8d4ebf0 memset, memcpy, sizeof consistency fixes
Just as with the OPENSSL_malloc calls, consistently use sizeof(*ptr)
for memset and memcpy.  Remove needless casts for those functions.
For memset, replace alternative forms of zero with 0.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-05-05 22:18:59 -04:00
Rich Salz
b4faea50c3 Use safer sizeof variant in malloc
For a local variable:
        TYPE *p;
Allocations like this are "risky":
        p = OPENSSL_malloc(sizeof(TYPE));
if the type of p changes, and the malloc call isn't updated, you
could get memory corruption.  Instead do this:
        p = OPENSSL_malloc(sizeof(*p));
Also fixed a few memset() calls that I noticed while doing this.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-05-04 15:00:13 -04:00
Matt Caswell
0f113f3ee4 Run util/openssl-format-source -v -c .
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22 09:20:09 +00:00
Richard Levitte
91316e6765 Check for FindNextFile when defining it rather than FindFirstFile
Reviewed-by: Matt Caswell <matt@openssl.org>
2014-11-28 23:27:21 +01:00
Richard Levitte
360928b7d0 Followup on RT3334 fix: make sure that a directory that's the empty
string returns 0 with errno = ENOENT.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2014-09-03 21:57:44 +02:00
Phil Mesnier
6a14fe7576 RT3334: Fix crypto/LPdir_win.c
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
2014-09-03 21:56:40 +02:00
Andy Polyakov
a6efc2d1b8 Fix mingw warnings. 2006-10-23 07:41:05 +00:00
Richard Levitte
bb09fd2bb6 Import changed files from LPlib. The changes are logged as follows
for LPdir_unix.c in LPlib.  For the other files, only the last log
entry applies.

----------------------------
revision 1.11
date: 2004/09/23 22:07:22;  author: _cvs_levitte;  state: Exp;  lines: +20 -6
Define my own macro LP_ENTRY_SIZE to express the size of my own
buffering of directory entries, and make it depend on whichever comes
first of PATH_MAX and NAME_MAX.  As a fallback, make sure it's set to
255 if neither PATH_MAX or NAME_MAX were defined.  Also, if the size
given from PATH_MAX or NAME_MAX is less than 255, force LP_ENTRY_SIZE
to be 255.

It makes no harm whatsoever if LP_ENTRY_SIZE is larger than the
maximum local path name limit.  It does make a lot of harm if
LP_ENTRY_SIZE is smaller.  255 seemed like a fairly acceptable default
when nothing else is available.
----------------------------
revision 1.10
date: 2004/08/26 13:36:05;  author: _cvs_levitte;  state: Exp;  lines: +13 -13
License correction.  I am not REGENTS, just a COPYRIGHT HOLDER.
----------------------------
2004-09-23 22:11:39 +00:00
Andy Polyakov
da2ee71de5 Typos and due casts. As for the latter. It's "safe" to cast as below,
because "wrong" casts will either be optimized away or never performed.
2004-07-25 16:48:28 +00:00
Richard Levitte
f744f92adb From LPlib:
Apparently, the length *including* the NUL byte should be used.

Contributed by Andy Polyakov <appro@fy.chalmers.se>
2004-07-22 18:34:06 +00:00
Richard Levitte
75f134c077 From LPlib:
Make a nicer comment, as we don't really know for sure that it's
really needed, and just want to play on the safe side.

Suggest by Andy Polyakov <appro@fy.chalmers.se>
2004-07-22 13:00:14 +00:00
Richard Levitte
765e231a7c From LPlib:
Some code beautification.

Change the macro CP_THREAD_ACP to CP_ACP, because the latter is more
widely defined.

Add a conditional macro definition in case FindFirstFile and
FindNextFile aren't properly defined (might happen on WinCE).

Suggested by Andy Polyakov <appro@fy.chalmers.se>
2004-07-21 21:16:21 +00:00
Richard Levitte
64ba6cf222 From LPlib:
Windows changes that detects if multibyte characters are available and
deals with them properly.

Contributed by Andy Polyakov <appro@fy.chalmers.se>
2004-07-20 21:24:43 +00:00
Richard Levitte
210a4f78ae 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().
2004-07-19 16:36:28 +00:00
Richard Levitte
a2400fcab8 Copy a few files from LPlib (a new project of mine), add a wrapper.
Now we have directory reading capabilities for VMS as well, and all
of it in a fairly general manner.
2004-07-10 13:16:02 +00:00