From 959e991c674f73a85c3016679f975b09958b0754 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Thu, 15 Dec 2011 22:09:57 +0400 Subject: [PATCH] cleanup --- source/bforce/bforce.c | 2 -- source/bforce/sess_main.c | 15 +++++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/bforce/bforce.c b/source/bforce/bforce.c index b24673b..6713abc 100644 --- a/source/bforce/bforce.c +++ b/source/bforce/bforce.c @@ -449,8 +449,6 @@ int main(int argc, char *argv[], char *envp[]) (void)debug_setfilename(log_getfilename(LOG_FILE_DEBUG)); #endif - printf("split_inb: %s\n", conf_boolean(cf_split_inbound)?"yes":"no"); - if( opts.daemon ) rc = bforce_daemon(&opts); else if( role ) diff --git a/source/bforce/sess_main.c b/source/bforce/sess_main.c index 59b5d2c..8410a54 100644 --- a/source/bforce/sess_main.c +++ b/source/bforce/sess_main.c @@ -317,10 +317,11 @@ int session_set_inbound(void) p_inb = "./"; } - if( conf_boolean(cf_split_inbound) ) { - char buf[500]; + if( conf_boolean(cf_split_inbound) ) + { + char buf[PATH_MAX+31]; if( state.node.addr.point ) { - sprintf( buf, "%s%d:%d/%d.%d/%s-in/", + snprintf( buf, PATH_MAX, "%s%d:%d/%d.%d/%s-in/", p_inb, state.node.addr.zone, state.node.addr.net, @@ -328,7 +329,7 @@ int session_set_inbound(void) state.node.addr.point, state.protected? "pwd": "unchecked" ); } else { - sprintf( buf, "%s%d:%d/%d/%s-in/", + snprintf( buf, PATH_MAX, "%s%d:%d/%d/%s-in/", p_inb, state.node.addr.zone, state.node.addr.net, @@ -337,9 +338,11 @@ int session_set_inbound(void) } log("inbound: %s", buf); state.inbound = (char*)xstrcpy(buf); - sprintf( buf, "/bin/mkdir -p %s -m 700", state.inbound ); + snprintf( buf, PATH_MAX+30, "/bin/mkdir -p %s -m 700", state.inbound ); /* 30 additional chars allowed */ system( buf ); - } else { + } + else + { state.inbound = (char*)xstrcpy(p_inb); }