summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/lib/roken/strsep_copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/heimdal/lib/roken/strsep_copy.c')
-rw-r--r--crypto/heimdal/lib/roken/strsep_copy.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/heimdal/lib/roken/strsep_copy.c b/crypto/heimdal/lib/roken/strsep_copy.c
index f097022..abe9731 100644
--- a/crypto/heimdal/lib/roken/strsep_copy.c
+++ b/crypto/heimdal/lib/roken/strsep_copy.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 2000, 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: strsep_copy.c,v 1.3 2000/06/29 03:13:36 assar Exp $");
+RCSID("$Id: strsep_copy.c,v 1.4 2002/08/14 17:20:40 joda Exp $");
#endif
#include <string.h>
@@ -53,8 +53,10 @@ strsep_copy(const char **stringp, const char *delim, char *buf, size_t len)
return -1;
*stringp = *stringp + strcspn(*stringp, delim);
l = min(len, *stringp - save);
- memcpy(buf, save, l);
- buf[l] = '\0';
+ if(len > 0) {
+ memcpy(buf, save, l);
+ buf[l] = '\0';
+ }
l = *stringp - save;
if(**stringp == '\0')
OpenPOWER on IntegriCloud