* path.cc (cygwin_conv_path): Handle NULL "from" path gracefully.

* path.sgml (func-cygwin-conv-path): Document returning EINVAL if
	"from" is NULL.
This commit is contained in:
Corinna Vinschen 2013-06-21 08:14:26 +00:00
parent e18222a23c
commit d21edf5276
3 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2013-06-21 Corinna Vinschen <corinna@vinschen.de>
* path.cc (cygwin_conv_path): Handle NULL "from" path gracefully.
* path.sgml (func-cygwin-conv-path): Document returning EINVAL if
"from" is NULL.
2013-06-19 Christopher Faylor <me.cygwin2013@cgf.cx> 2013-06-19 Christopher Faylor <me.cygwin2013@cgf.cx>
* winf.h (av::unshift): Make __reg2. * winf.h (av::unshift): Make __reg2.

View File

@ -3212,6 +3212,12 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
bool relative = !!(what & CCP_RELATIVE); bool relative = !!(what & CCP_RELATIVE);
what &= CCP_CONVTYPE_MASK; what &= CCP_CONVTYPE_MASK;
if (!from)
{
set_errno (EINVAL);
return -1;
}
switch (what) switch (what)
{ {
case CCP_POSIX_TO_WIN_A: case CCP_POSIX_TO_WIN_A:

View File

@ -42,7 +42,7 @@ buffer size in bytes. Otherwise, it returns 0 on success, or -1 on
error and errno is set to one of the below values.</para> error and errno is set to one of the below values.</para>
<programlisting> <programlisting>
EINVAL what has an invalid value. EINVAL what has an invalid value or from is NULL.
EFAULT from or to point into nirvana. EFAULT from or to point into nirvana.
ENAMETOOLONG the resulting path is longer than 32K, or, in case ENAMETOOLONG the resulting path is longer than 32K, or, in case
of what == CCP_POSIX_TO_WIN_A, longer than MAX_PATH. of what == CCP_POSIX_TO_WIN_A, longer than MAX_PATH.