summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schuster <theBohemian@gmx.net>2008-08-12 11:14:43 +0000
committerRobert Schuster <theBohemian@gmx.net>2008-08-12 11:14:43 +0000
commit18ff4de7c1fd5b947b8029401e448fa4b5d597ce (patch)
tree996fb3b4e942e2fbc92fd2f37642d252e2bbb5c0
parent17564e262cb39a88c3f268d8b92bc286c974539d (diff)
downloadclasspath-18ff4de7c1fd5b947b8029401e448fa4b5d597ce.tar.gz
2008-08-12 Robert Schuster <robertschuster@fsfe.org>
* native/jni/java-net/local.c (local_bind): Removed fprintf call, fixed access outside of array bounds.
-rw-r--r--ChangeLog6
-rw-r--r--native/jni/java-net/local.c13
2 files changed, 8 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 319abe12f..15280ae87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-12 Robert Schuster <robertschuster@fsfe.org>
+
+ * native/jni/java-net/local.c
+ (local_bind): Removed fprintf call, fixed access outside
+ of array bounds.
+
2008-07-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* m4/acinclude.m4 (CLASSPATH_COND_IF): New macro.
diff --git a/native/jni/java-net/local.c b/native/jni/java-net/local.c
index b7ec6f264..53830f371 100644
--- a/native/jni/java-net/local.c
+++ b/native/jni/java-net/local.c
@@ -73,27 +73,18 @@ local_create (int stream)
return socket (PF_UNIX, stream ? SOCK_STREAM : SOCK_DGRAM, 0);
}
-static int gcc_sucks = 0;
-
int
local_bind (int fd, const char *addr)
{
struct sockaddr_un saddr;
- /* For some reason, GCC 4.0.1 on Darwin/x86 MODIFIES the `addr'
- pointer in the CALLER's STACK FRAME after calling this function,
- but if we add this statement below, it doesn't! */
- if (gcc_sucks)
- fprintf (stderr, "bind %p\n", addr);
-
- if (strlen (addr) > sizeof (saddr.sun_path))
+ if (strlen (addr) >= sizeof (saddr.sun_path))
{
errno = ENAMETOOLONG;
return -1;
}
- strncpy (saddr.sun_path, addr, sizeof (saddr.sun_path));
- saddr.sun_path[sizeof (saddr.sun_path)] = '\0';
+ strcpy (saddr.sun_path, addr);
saddr.sun_family = AF_LOCAL;
return bind (fd, (struct sockaddr *) &saddr, SUN_LEN (&saddr));