openbsd-ports/telephony/kamailio/patches/patch-lib_binrpc_binrpc_api_c

37 lines
1.5 KiB
Plaintext

$OpenBSD: patch-lib_binrpc_binrpc_api_c,v 1.1 2012/09/15 12:16:18 sthen Exp $
--- lib/binrpc/binrpc_api.c.orig Sun Jul 29 23:47:24 2012
+++ lib/binrpc/binrpc_api.c Sun Jul 29 23:49:21 2012
@@ -149,10 +149,10 @@ static int connect_unix_sock(char* name, int type, str
s=-1;
memset(&ifsun, 0, sizeof (struct sockaddr_un));
len=strlen(name);
- if (len>UNIX_PATH_MAX){
+ if (len>sizeof(ifsun.sun_path)){
snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1,
"connect_unix_sock: name too long "
- "(%d > %d): %s", len, UNIX_PATH_MAX, name);
+ "(%d > %ld): %s", len, sizeof(ifsun.sun_path), name);
goto error;
}
ifsun.sun_family=AF_UNIX;
@@ -174,16 +174,16 @@ static int connect_unix_sock(char* name, int type, str
if (sock_dir==0)
sock_dir="/tmp";
retry:
- ret=snprintf(mysun->sun_path, UNIX_PATH_MAX, "%s/" NAME "_%d",
+ ret=snprintf(mysun->sun_path, sizeof(mysun->sun_path), "%s/" NAME "_%d",
sock_dir, rand());
- if ((ret<0) ||(ret>=UNIX_PATH_MAX)){
+ if ((ret<0) ||(ret>=sizeof(mysun->sun_path))){
snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1,
"connect_unix_sock: buffer overflow while trying to"
"generate unix datagram socket name");
goto error;
}
}else{
- if (strlen(reply_socket)>UNIX_PATH_MAX){
+ if (strlen(reply_socket)>sizeof(mysun->sun_path)){
snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1,
"connect_unix_sock: buffer overflow while trying to"
"use the provided unix datagram socket name (%s)",