From 4042ebe3d1e5f09c91447a59d70979cca445274a Mon Sep 17 00:00:00 2001 From: Renaud Fivet <renaud.fivet@gmail.com> Date: Tue, 24 Mar 2015 11:57:10 +0800 Subject: [PATCH] Fix CID 39916: potential dereference of Null pointer. --- search.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/search.c b/search.c index 689bbee..1507106 100644 --- a/search.c +++ b/search.c @@ -1377,9 +1377,10 @@ static int rmcstr(void) if ((rmcptr->rstr = malloc(mj + 1)) == NULL) { mloutstr( "%Out of memory") ; status = FALSE; + } else { + strncpy(rmcptr->rstr, patptr - mj, mj); + rmcptr++; } - strncpy(rmcptr->rstr, patptr - mj, mj); - rmcptr++; } rmcptr->mc_type = MCNIL;