This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi, currently, sendto() crashes when the specified addr is NULL; the attached patch fixes it making sendto() with NULL addr behave as it would be a plain send(). Thanks, -- Pino Toscano
Hurd: sendto: do not crash when addr is NULL
Work also when the specified addr is NULL; simplify also the usage of err.
2012-05-20 Pino Toscano <toscano.pino@tiscali.it>
* sysdeps/mach/hurd/sendto.c: Consider also when addr is NULL.
--- a/sysdeps/mach/hurd/sendto.c
+++ b/sysdeps/mach/hurd/sendto.c
@@ -33,11 +33,11 @@ __sendto (int fd,
const struct sockaddr_un *addr,
socklen_t addr_len)
{
- addr_port_t aport;
- error_t err;
+ addr_port_t aport = MACH_PORT_NULL;
+ error_t err = 0;
size_t wrote;
- if (addr->sun_family == AF_LOCAL)
+ if (addr != NULL && addr->sun_family == AF_LOCAL)
{
/* For the local domain, we must look up the name as a file and talk
to it with the ifsock protocol. */
@@ -52,13 +52,11 @@ __sendto (int fd,
if (err)
return __hurd_fail (err);
}
- else
- err = EIEIO;
/* Get an address port for the desired destination address. */
err = HURD_DPORT_USE (fd,
({
- if (err)
+ if (aport == MACH_PORT_NULL && addr != NULL)
err = __socket_create_address (port,
addr->sun_family,
(char *) addr,
Attachment:
signature.asc
Description: This is a digitally signed message part.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |