php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17074 Cannot bind() a socket to a specific port in FreeBSD
Submitted: 2002-05-07 10:48 UTC Modified: 2002-07-01 16:54 UTC
From: antonio dot bonifati at polimi dot it Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.2.0 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: antonio dot bonifati at polimi dot it
New email:
PHP Version: OS:

 

 [2002-05-07 10:48 UTC] antonio dot bonifati at polimi dot it
please see also bug #10830
this bug hasn't been fixed yet in php 4.2.0
could you fix it?

i fixed it for myself changing the line 1001
in ext/sockets/sockets.c:

retval = bind(php_sock->bsd_socket, (struct sockaddr *)sa, sizeof(sa_storage));

with this one:

retval = bind(php_sock->bsd_socket, (struct sockaddr *)sa, sizeof(struct sockaddr));

it seems that the last parameter to bind is broken

best regards

Antonio

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-07 12:58 UTC] jason@php.net
Thanks for the report antonio.

From an initial glance, the fix you suggest looks correct, however, I still need to run it through a few tests.

Thanks,
-Jason
 [2002-05-07 15:14 UTC] jason@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/

sizeof(sockaddr_in) is the appropriate fix
 [2002-07-01 16:54 UTC] jason@php.net
Forgot to mark this one closed
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Jul 04 15:05:45 2022 UTC