267981508a
- merge parts of pkg/SECURITY into pkg/MESSAGE - fix license marker feedback and ok ajacoutot@
145 lines
5.2 KiB
Plaintext
145 lines
5.2 KiB
Plaintext
$OpenBSD: patch-src_keyboard_c,v 1.4 2008/08/25 15:14:43 jasper Exp $
|
|
--- src/keyboard.c.orig Fri Jan 9 19:16:01 2004
|
|
+++ src/keyboard.c Fri Aug 22 20:46:38 2008
|
|
@@ -36,6 +36,7 @@ $Id: keyboard.c,v 1.25 2004/01/09 18:16:01 ericprev Ex
|
|
#include <sys/socket.h>
|
|
#include <sys/param.h>
|
|
#include <sys/sem.h>
|
|
+#include <netinet/in.h>
|
|
#include <netdb.h>
|
|
|
|
#ifdef WITH_GCRYPT
|
|
@@ -237,7 +238,7 @@ static void keyb_do_xdownload(const char *cmd, int sck
|
|
{ /* we have a full access, the remote side will be able to contact us */
|
|
char tmp[512];
|
|
|
|
- sprintf(tmp,"%s:%hu",host_ip,com_port);
|
|
+ snprintf(tmp, sizeof(tmp), "%s:%hu",host_ip,com_port);
|
|
if(user_in_list(hub_user_list,fields[2]))
|
|
send_dc_line(sck,"$ConnectToMe",fields[2],tmp,NULL);
|
|
else
|
|
@@ -573,7 +574,7 @@ static void keyb_do_csearch(const char *cmd, int sck,
|
|
if(!md5sum_of_file(pattern,md5sum))
|
|
{
|
|
char txt_md[3*MD5SUMLEN+1];
|
|
- md5tostr(md5sum,txt_md);
|
|
+ md5tostr(md5sum,txt_md,sizeof txt_md);
|
|
g_string_sprintfa(query,".%s",txt_md);
|
|
|
|
/* add a tos entry for this search */
|
|
@@ -588,7 +589,7 @@ static void keyb_do_csearch(const char *cmd, int sck,
|
|
if(!md5sum_of_file(pattern,md5sum))
|
|
{
|
|
char txt_md[3*MD5SUMLEN+1];
|
|
- md5tostr(md5sum,txt_md);
|
|
+ md5tostr(md5sum,txt_md,sizeof txt_md);
|
|
g_string_sprintfa(query,".%s",txt_md);
|
|
|
|
/* add a tos entry for this search */
|
|
@@ -878,7 +879,7 @@ static void keyb_do_xfer(const char *cmd, int sck, cha
|
|
if(nw==NULL)
|
|
continue;
|
|
|
|
- sprintf(tmp,"%lu",(unsigned long)(nw->thread_id));
|
|
+ snprintf(tmp,sizeof(tmp),"%lu",(unsigned long)(nw->thread_id));
|
|
if(nw->remote_nick==NULL)
|
|
{
|
|
disp_msg(XFER_LST_R,NULL,tmp,"",NULL);
|
|
@@ -1201,7 +1202,7 @@ static void keyb_do_kill(const char *cmd, int sck, cha
|
|
}
|
|
|
|
/* modify our nick name locally */
|
|
- id=strtoul(t,NULL,10);
|
|
+ id=(pthread_t)strtoul(t,NULL,10);
|
|
|
|
/* to shutdown a thread, it is very easy, we just close the socket it uses */
|
|
/* thus, it will abort himself, freeing all ressources it allocates */
|
|
@@ -1727,7 +1728,7 @@ static void keyb_do_ls(const char *cmd, int sck, char
|
|
{ /* we have a full access, the remote side will be able to contact us */
|
|
char tmp[512];
|
|
|
|
- sprintf(tmp,"%s:%hu",host_ip,com_port);
|
|
+ snprintf(tmp, sizeof(tmp), "%s:%hu",host_ip,com_port);
|
|
send_dc_line(sck,"$ConnectToMe",nick,tmp,NULL);
|
|
disp_msg(INFO_MSG,"","/LS in $ConnectToMe",NULL);
|
|
}
|
|
@@ -2325,7 +2326,7 @@ static void keyb_do_vars(const char *cmd, int sck, cha
|
|
disp_msg(VAR_MSG,NULL,"cnx_type",cnx_type,NULL);
|
|
disp_msg(VAR_MSG,NULL,"email",email,NULL);
|
|
|
|
- sprintf(buf,"%lf",offset_sizeof_data);
|
|
+ snprintf(buf,sizeof(buf),"%lf",offset_sizeof_data);
|
|
disp_msg(VAR_MSG,NULL,"offset",buf,NULL);
|
|
|
|
disp_msg(VAR_MSG,NULL,"hostip",org_host_ip,NULL);
|
|
@@ -2342,7 +2343,7 @@ static void keyb_do_vars(const char *cmd, int sck, cha
|
|
/* else, we are connected */
|
|
if(main_sck>-1)
|
|
{
|
|
- sprintf(buf,"%d",main_sck);
|
|
+ snprintf(buf,sizeof(buf),"%d",main_sck);
|
|
disp_msg(VAR_MSG,NULL,"main_sck",buf,NULL);
|
|
}
|
|
else
|
|
@@ -2351,12 +2352,12 @@ static void keyb_do_vars(const char *cmd, int sck, cha
|
|
|
|
if(find_sim_input_delay("/RECON",&s_time))
|
|
{
|
|
- sprintf(buf,"=>%ld",s_time);
|
|
+ snprintf(buf,sizeof(buf),"=>%ld",s_time);
|
|
disp_msg(VAR_MSG,NULL,"main_sck",buf,NULL);
|
|
}
|
|
else
|
|
{
|
|
- sprintf(buf,"%d",main_sck);
|
|
+ snprintf(buf,sizeof(buf),"%d",main_sck);
|
|
disp_msg(VAR_MSG,NULL,"main_sck",buf,NULL);
|
|
}
|
|
}
|
|
@@ -2369,14 +2370,14 @@ static void keyb_do_vars(const char *cmd, int sck, cha
|
|
g_string_free(shared_dir,TRUE);
|
|
}
|
|
|
|
- sprintf(buf,"%d",((int)cnx_opt)&255);
|
|
+ snprintf(buf,sizeof(buf),"%d",((int)cnx_opt)&255);
|
|
disp_msg(VAR_MSG,NULL,"cnx_opt",buf,NULL);
|
|
|
|
- sprintf(buf,"%d",semctl(bl_semid,UL_SPD_SEMA,GETVAL,v));
|
|
+ snprintf(buf,sizeof(buf),"%d",semctl(bl_semid,UL_SPD_SEMA,GETVAL,v));
|
|
disp_msg(VAR_MSG,NULL,"ubl",buf,NULL);
|
|
- sprintf(buf,"%d",semctl(bl_semid,DL_SPD_SEMA,GETVAL,v));
|
|
+ snprintf(buf,sizeof(buf),"%d",semctl(bl_semid,DL_SPD_SEMA,GETVAL,v));
|
|
disp_msg(VAR_MSG,NULL,"dbl",buf,NULL);
|
|
- sprintf(buf,"%d",semctl(bl_semid,GATHER_SPD_SEMA,GETVAL,v));
|
|
+ snprintf(buf,sizeof(buf),"%d",semctl(bl_semid,GATHER_SPD_SEMA,GETVAL,v));
|
|
disp_msg(VAR_MSG,NULL,"gbl",buf,NULL);
|
|
|
|
/* display int vars */
|
|
@@ -2417,22 +2418,22 @@ static void keyb_do_vars(const char *cmd, int sck, cha
|
|
}
|
|
}
|
|
|
|
- sprintf(buf,"%u",com_port);
|
|
+ snprintf(buf,sizeof(buf),"%u",com_port);
|
|
disp_msg(VAR_MSG,NULL,"com_port",buf,NULL);
|
|
|
|
/* display socks values */
|
|
disp_msg(VAR_MSG,NULL,"socks_ip",(socks_ip!=NULL)?socks_ip:"",NULL);
|
|
- sprintf(buf,"%hu",socks_port);
|
|
+ snprintf(buf,sizeof(buf),"%hu",socks_port);
|
|
disp_msg(VAR_MSG,NULL,"socks_port",buf,NULL);
|
|
disp_msg(VAR_MSG,NULL,"socks_name",(socks_name!=NULL)?socks_name:"",NULL);
|
|
|
|
disp_msg(VAR_MSG,NULL,"vshare_dir",(vshare_directory!=NULL)?vshare_directory:"",NULL);
|
|
|
|
- sprintf(buf,"%u:%u",gdl_as_port_range[0],gdl_as_port_range[1]);
|
|
+ snprintf(buf,sizeof(buf),"%u:%u",gdl_as_port_range[0],gdl_as_port_range[1]);
|
|
disp_msg(VAR_MSG,NULL,"gdlasports",buf,NULL);
|
|
UNLOCK_READ(user_info);
|
|
|
|
- sprintf(buf,"%d,%d,%d,%d",hub_tos,udp_tos,dl_tos,ul_tos);
|
|
+ snprintf(buf,sizeof(buf),"%d,%d,%d,%d",hub_tos,udp_tos,dl_tos,ul_tos);
|
|
disp_msg(VAR_MSG,NULL,"tos",buf,NULL);
|
|
|
|
if(fake_dcpp_version==NULL)
|