summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-04-16 13:12:45 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-04-16 13:12:45 -0700
commitff219e57c0ffe5ac2816f79677ce4f1afa677277 (patch)
tree85ac53d9a88bee1d941e844b7599cf40ccaddfbb
parentcebc8fb0862a8e1ecd86f9d09b0a3fca0f0781fa (diff)
parent6435d27f9d45d01fbd15bcc3dcd9617b86b825bb (diff)
downloadbionic-ff219e57c0ffe5ac2816f79677ce4f1afa677277.zip
bionic-ff219e57c0ffe5ac2816f79677ce4f1afa677277.tar.gz
bionic-ff219e57c0ffe5ac2816f79677ce4f1afa677277.tar.bz2
am 6435d27f: Merge "bionic: fix NULL parameter failure in getcwd()"
* commit '6435d27f9d45d01fbd15bcc3dcd9617b86b825bb': bionic: fix NULL parameter failure in getcwd()
-rw-r--r--libc/unistd/getcwd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libc/unistd/getcwd.c b/libc/unistd/getcwd.c
index 1cf80e9..1172445 100644
--- a/libc/unistd/getcwd.c
+++ b/libc/unistd/getcwd.c
@@ -26,10 +26,15 @@
* SUCH DAMAGE.
*/
#include <unistd.h>
+#include <errno.h>
extern int __getcwd(char * buf, size_t size);
char *getcwd(char *buf, size_t size)
{
+ if (buf == NULL || size == 0) {
+ errno = EINVAL;
+ return NULL;
+ }
return ( __getcwd(buf, size) < 0 ) ? NULL : buf;
}