openbsd-ports/www/junkbuster/patches/patch-ssplit_c

35 lines
1.1 KiB
Plaintext

$OpenBSD: patch-ssplit_c,v 1.2 2001/06/09 02:36:49 angelos Exp $
--- ssplit.c.orig Fri Oct 30 22:58:47 1998
+++ ssplit.c Fri Jun 8 22:04:40 2001
@@ -18,6 +18,7 @@ char *ssplit_rcs = "$Id: ssplit.c,v 1.6
* l = flag indicating whether to ignore leading field separators
*/
+#include <stdio.h>
#include <string.h>
int ssplit(char *s, char *c, char *v[], int n, int m, int l)
@@ -58,7 +59,10 @@ int ssplit(char *s, char *c, char *v[],
xsize = 256;
- x = (char **) zalloc((xsize) * sizeof(char *));
+ if((x = (char **) zalloc((xsize) * sizeof(char *))) == NULL) {
+ fprintf(stderr, "%s:%d zalloc failed\n", __FILE__, __LINE__);
+ exit(-1);
+ }
x[xi++] = (char *) p; /* first pointer is the beginning of string */
@@ -73,6 +77,10 @@ int ssplit(char *s, char *c, char *v[],
char **new_x = (char **)
zalloc((new_xsize) * sizeof(char *));
+ if(new_x == NULL) {
+ fprintf(stderr, "%s:%d zalloc failed\n", __FILE__, __LINE__);
+ exit(-1);
+ }
for(i=0; i < xsize; i++) new_x[i] = x[i];
free(x);