aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorsandman <sandman@69ca8d6d-28ef-0310-b511-8ec308f3f277>2002-07-19 00:05:54 +0000
committersandman <sandman@69ca8d6d-28ef-0310-b511-8ec308f3f277>2002-07-19 00:05:54 +0000
commit88c37e3b6514ce684e6f5f38282176f34fc73d0d (patch)
tree945ff88bbbde5a32c2b3342b22d801be90ea40f2 /libbb
parentd4dbffaf02bf1c39047688988c44c8d60277a76a (diff)
downloadbusybox-w32-88c37e3b6514ce684e6f5f38282176f34fc73d0d.tar.gz
busybox-w32-88c37e3b6514ce684e6f5f38282176f34fc73d0d.tar.bz2
busybox-w32-88c37e3b6514ce684e6f5f38282176f34fc73d0d.zip
Applied vodz' patches #49 and #50 (with a small correction in runshell.c)
#49: I found one memory overflow and memory leak in "ln" applet. Last patch reduced also 54 bytes. ;) #50: I found bug in loginutils/Makefile.in. New patch have also new function to libbb and aplied this to applets and other cosmetic changes. git-svn-id: svn://busybox.net/trunk/busybox@5066 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Makefile.in2
-rw-r--r--libbb/concat_path_file.c3
-rw-r--r--libbb/run_shell.c5
-rw-r--r--libbb/xconnect.c1
-rw-r--r--libbb/xreadlink.c3
5 files changed, 6 insertions, 8 deletions
diff --git a/libbb/Makefile.in b/libbb/Makefile.in
index 70cc26dc1..e7ca9aa55 100644
--- a/libbb/Makefile.in
+++ b/libbb/Makefile.in
@@ -41,7 +41,7 @@ LIBBB_SRC:= \
41 simplify_path.c inet_common.c inode_hash.c obscure.c pwd2spwd.c xfuncs.c \ 41 simplify_path.c inet_common.c inode_hash.c obscure.c pwd2spwd.c xfuncs.c \
42 correct_password.c change_identity.c setup_environment.c run_shell.c \ 42 correct_password.c change_identity.c setup_environment.c run_shell.c \
43 pw_encrypt.c restricted_shell.c xgethostbyname2.c create_icmp6_socket.c \ 43 pw_encrypt.c restricted_shell.c xgethostbyname2.c create_icmp6_socket.c \
44 xconnect.c 44 xconnect.c bb_asprintf.c
45 45
46LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC)) 46LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC))
47 47
diff --git a/libbb/concat_path_file.c b/libbb/concat_path_file.c
index e62b99ef6..0146606a1 100644
--- a/libbb/concat_path_file.c
+++ b/libbb/concat_path_file.c
@@ -38,8 +38,7 @@ extern char *concat_path_file(const char *path, const char *filename)
38 lc = last_char_is(path, '/'); 38 lc = last_char_is(path, '/');
39 while (*filename == '/') 39 while (*filename == '/')
40 filename++; 40 filename++;
41 outbuf = xmalloc(strlen(path)+strlen(filename)+1+(lc==NULL)); 41 bb_asprintf(&outbuf, "%s%s%s", path, (lc==NULL)? "/" : "", filename);
42 sprintf(outbuf, "%s%s%s", path, (lc==NULL)? "/" : "", filename);
43 42
44 return outbuf; 43 return outbuf;
45} 44}
diff --git a/libbb/run_shell.c b/libbb/run_shell.c
index 30050fecb..b26eba115 100644
--- a/libbb/run_shell.c
+++ b/libbb/run_shell.c
@@ -60,9 +60,8 @@ void run_shell ( const char *shell, int loginshell, const char *command, const c
60 args [0] = get_last_path_component ( xstrdup ( shell )); 60 args [0] = get_last_path_component ( xstrdup ( shell ));
61 61
62 if ( loginshell ) { 62 if ( loginshell ) {
63 char *args0 = xmalloc ( xstrlen ( args [0] ) + 2 ); 63 char *args0;
64 args0 [0] = '-'; 64 bb_asprintf ( &args0, "-%s", args [0] );
65 strcpy ( args0 + 1, args [0] );
66 args [0] = args0; 65 args [0] = args0;
67 } 66 }
68 67
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
index d6d144f3f..9e771495d 100644
--- a/libbb/xconnect.c
+++ b/libbb/xconnect.c
@@ -6,6 +6,7 @@
6 * 6 *
7 */ 7 */
8 8
9#include "inet_common.h"
9#include <unistd.h> 10#include <unistd.h>
10#include <string.h> 11#include <string.h>
11#include <stdlib.h> 12#include <stdlib.h>
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c
index 932e487a5..9944b5129 100644
--- a/libbb/xreadlink.c
+++ b/libbb/xreadlink.c
@@ -24,7 +24,7 @@ extern char *xreadlink(const char *path)
24 buf = xrealloc(buf, bufsize += GROWBY); 24 buf = xrealloc(buf, bufsize += GROWBY);
25 readsize = readlink(path, buf, bufsize); /* 1st try */ 25 readsize = readlink(path, buf, bufsize); /* 1st try */
26 if (readsize == -1) { 26 if (readsize == -1) {
27 perror_msg("%s:%s", applet_name, path); 27 perror_msg("%s", path);
28 return NULL; 28 return NULL;
29 } 29 }
30 } 30 }
@@ -34,4 +34,3 @@ extern char *xreadlink(const char *path)
34 34
35 return buf; 35 return buf;
36} 36}
37