From: Chris Mikkelson Date: Thu, 25 Oct 2012 19:17:45 +0000 (-0500) Subject: Replace FreeBSD-specific strnstr() with memmem() X-Git-Url: https://git.mikk.net/?a=commitdiff_plain;h=9b750142c129356d10667b35ec8a6241429e9c71;p=smtpsink Replace FreeBSD-specific strnstr() with memmem() --- diff --git a/smtp.c b/smtp.c index d64042b..e6e394e 100644 --- a/smtp.c +++ b/smtp.c @@ -15,6 +15,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#define _GNU_SOURCE + #include #include #include @@ -22,6 +24,7 @@ #include #include #include +#include #include #include @@ -270,7 +273,7 @@ do_smtp(struct conn *c, char **buf, int *len) if (c->dstate == 5) return smtpd_enddata(c); return 1; } else { - char *t = strnstr(*buf, "\r\n", *len); + char *t = memmem(*buf, *len, "\r\n", 2); char *cmd = *buf; int clen;