Commits

Ruslan Osmanov committed c322691

Fix

Comments (0)

Files changed (2)

classes/buffer_event.c

 		sun = (struct sockaddr_un *) &sa;
 
 		sun->sun_family = AF_UNIX;
-		strncpy(sun->sun_path, addr, addr_len);
+		strcpy(sun->sun_path, addr);
 
-		sa_len = sizeof(sun->sun_family) + addr_len;
+		sa_len = sizeof(struct sockaddr_un);
 	} else if (sync_resolve) {
 		/* The PHP API *syncronously* resolves hostname, if it doesn't look
 		 * like IP(v4/v6) */
 	char               *hostname;
 	int                 hostname_len;
 	long                port;
-	long                family;
+	long                family       = AF_UNSPEC;
 
 #if HAVE_EVENT_EXTRA_LIB
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O!sl|l",

classes/listener.c

 		if (family == AF_UNIX) {
 			sun             = (struct sockaddr_un *) &sa;
 			sun->sun_family = AF_UNIX;
-			strncpy(sun->sun_path, Z_STRVAL_PP(ppztarget), Z_STRLEN_PP(ppztarget));
+			strcpy(sun->sun_path, Z_STRVAL_PP(ppztarget));
 
-			sa_len = sizeof(sun->sun_family) + Z_STRLEN_PP(ppztarget);
+			/*sa_len = sizeof(sun->sun_family) + Z_STRLEN_PP(ppztarget);*/
+			sa_len = sizeof(struct sockaddr_un);
 		} else if (php_network_parse_network_address_with_port(Z_STRVAL_PP(ppztarget), Z_STRLEN_PP(ppztarget),
 					&sa, &sa_len TSRMLS_CC) != SUCCESS) {
 			ZVAL_NULL(zself);