1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-29 10:18:30 +00:00
freebsd-ports/devel/cgilib/files/patch-cgi.c
Dmitry Sivachenko 78fe2f47eb Update to 0.6.
PR:		123370
Submitted by:	leeym
2008-05-19 15:18:46 +00:00

34 lines
552 B
C

--- cgi.c.orig 2008-05-03 09:51:51.000000000 -0700
+++ cgi.c 2008-05-03 09:52:40.000000000 -0700
@@ -227,6 +227,30 @@
return strdup (template);
}
+
+size_t
+strnlen(const char *s, size_t len)
+{
+ size_t i;
+
+ for(i = 0; i < len && s[i]; i++)
+ ;
+ return i;
+}
+
+char *
+strndup(const char *old, size_t sz)
+{
+ size_t len = strnlen (old, sz);
+ char *t = malloc(len + 1);
+
+ if (t != NULL) {
+ memcpy (t, old, len);
+ t[len] = '\0';
+ }
+ return t;
+}
+
/* cgiReadMultipart()
*
* Decode multipart/form-data