Date: Wed, 25 Jun 2008 12:34:56 GMT From: Gabor Kovesdan <gabor@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 144090 for review Message-ID: <200806251234.m5PCYuPO085737@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=144090 Change 144090 by gabor@gabor_server on 2008/06/25 12:34:28 - Cleanup and style changes - Use strlcpy which is safer than memcpy Affected files ... .. //depot/projects/soc2008/gabor_textproc/grep/grep.c#47 edit Differences ... ==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#47 (text+ko) ==== @@ -293,10 +293,11 @@ while (pat[0] == '*') pat++; - if (!xflag && (len == 0 || matchall)) { + if (len == 0 || matchall) { matchall = 1; return; } + if (patterns == pattern_sz) { pattern_sz *= 2; pattern = grep_realloc(pattern, ++pattern_sz * sizeof(*pattern)); @@ -322,7 +323,7 @@ len += 14 + extra; } else { pattern[patterns] = grep_malloc(len + 1); - memcpy(pattern[patterns], pat, len); + strlcpy(pattern[patterns], pat, len); pattern[patterns][len] = '\0'; } ++patterns; @@ -617,6 +618,8 @@ if (Fflag) cflags |= REG_NOSPEC; + else if (Gflag) + cflags |= REG_BASIC; else if (Eflag) cflags |= REG_EXTENDED; r_pattern = grep_calloc(patterns, sizeof(*r_pattern));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806251234.m5PCYuPO085737>