openbsd-ports/net/icb/patches/patch-icb_serverlist_c

43 lines
1.0 KiB
Plaintext
Raw Normal View History

$OpenBSD: patch-icb_serverlist_c,v 1.1 2001/05/14 16:42:54 millert Exp $
--- icb/serverlist.c.orig Fri Feb 24 14:20:29 1995
+++ icb/serverlist.c Mon May 14 10:33:04 2001
1998-07-15 18:38:20 -04:00
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "icb.h"
@@ -16,7 +17,8 @@ FILE *openserverfile()
1998-07-15 18:38:20 -04:00
struct stat statbuf;
char *personalsl;
char command[256];
- char pwd[256];
+ char pwd[MAXPATHLEN];
+ char *home;
1998-07-15 18:38:20 -04:00
FILE *ret;
#ifdef sgi
@@ -25,15 +27,19 @@ FILE *openserverfile()
1998-07-15 18:38:20 -04:00
#ifndef SYSV
getwd(pwd);
#else /* SYSV */
- getcwd(pwd, MAXPATHLEN+1);
+ getcwd(pwd, MAXPATHLEN);
#endif /* SYSV */
#ifdef sgi
#define SYSV
#endif
- chdir(getenv("HOME"));
+ home = getenv("HOME");
+ if (!home)
+ errx(1, "can't get home directory from env");
+ chdir(home);
1998-07-15 18:38:20 -04:00
if (!stat(PERSONALSL,&statbuf))
{
- sprintf(command,"/bin/cat %s %s\n", PERSONALSL, SERVERLIST);
+ snprintf(command, sizeof command, "/bin/cat %s %s\n",
+ PERSONALSL, SERVERLIST);
ret= popen(command,"r");
}
else