summaryrefslogtreecommitdiff
path: root/net/icb
diff options
context:
space:
mode:
authorchristos <christos@pkgsrc.org>1998-09-03 16:36:09 +0000
committerchristos <christos@pkgsrc.org>1998-09-03 16:36:09 +0000
commit7539fd86072c40a13831c7e16023d0b554f6f5e0 (patch)
treed924907e6fb1da422325748c217f90ff1b27159c /net/icb
parent14dfca8f1d9abbd892c843f3d22c262f4a404dd7 (diff)
downloadpkgsrc-7539fd86072c40a13831c7e16023d0b554f6f5e0.tar.gz
- use getcwd instead of getwd
- increase the buffer size appropriatetely for holding cwd to avoid overflow - don't core-dump if $HOME is not set - dynamically allocate command space to avoid overflow
Diffstat (limited to 'net/icb')
-rw-r--r--net/icb/patches/patch-ad76
1 files changed, 76 insertions, 0 deletions
diff --git a/net/icb/patches/patch-ad b/net/icb/patches/patch-ad
new file mode 100644
index 00000000000..66ab550f0f3
--- /dev/null
+++ b/net/icb/patches/patch-ad
@@ -0,0 +1,76 @@
+*** icb/serverlist.c.orig Fri Feb 24 16:20:29 1995
+--- icb/serverlist.c Thu Sep 3 10:37:50 1998
+***************
+*** 1,4 ****
+--- 1,5 ----
+ #include <stdio.h>
++ #include <pwd.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include "icb.h"
+***************
+*** 14,28 ****
+ FILE *openserverfile()
+ {
+ struct stat statbuf;
+! char *personalsl;
+! char command[256];
+! char pwd[256];
+ FILE *ret;
+
+ #ifdef sgi
+ #undef SYSV
+ #endif
+! #ifndef SYSV
+ getwd(pwd);
+ #else /* SYSV */
+ getcwd(pwd, MAXPATHLEN+1);
+--- 15,28 ----
+ FILE *openserverfile()
+ {
+ struct stat statbuf;
+! char *personalsl, *home;
+! char pwd[MAXPATHLEN+1];
+ FILE *ret;
+
+ #ifdef sgi
+ #undef SYSV
+ #endif
+! #if !defined(SYSV) && !(defined(BSD) && BSD >= 199306)
+ getwd(pwd);
+ #else /* SYSV */
+ getcwd(pwd, MAXPATHLEN+1);
+***************
+*** 30,40 ****
+ #ifdef sgi
+ #define SYSV
+ #endif
+! chdir(getenv("HOME"));
+ if (!stat(PERSONALSL,&statbuf))
+ {
+! sprintf(command,"/bin/cat %s %s\n", PERSONALSL, SERVERLIST);
+ ret= popen(command,"r");
+ }
+ else
+ ret= fopen(SERVERLIST,"r");
+--- 30,49 ----
+ #ifdef sgi
+ #define SYSV
+ #endif
+! if ((home = getenv("HOME")) == NULL) {
+! struct passwd *pw;
+! if ((pw = getpwuid(getuid())) == NULL)
+! home = ".";
+! home = pw->pw_dir;
+! }
+! chdir(home);
+ if (!stat(PERSONALSL,&statbuf))
+ {
+! char *command = malloc(strlen("/bin/cat \n") +
+! strlen(PERSONALSL) + strlen(SERVERLIST) + 1);
+! sprintf(command, "/bin/cat %s %s\n", PERSONALSL, SERVERLIST);
+ ret= popen(command,"r");
++ free(command);
+ }
+ else
+ ret= fopen(SERVERLIST,"r");