$OpenBSD: patch-resParser_l,v 1.3 2005/04/24 19:02:05 sturm Exp $ --- resParser.l.orig Thu Dec 25 22:32:56 2003 +++ resParser.l Thu Apr 21 20:07:16 2005 @@ -63,15 +63,7 @@ iddot [a-zA-Z][a-zA-Z0-9\.]* { {geomspec} { - int len = ::strlen( yytext ); - if ( len >= LEX_BUFFER_MAX ) { - ::strncpy( lexerBuffer, yytext, LEX_BUFFER_MAX ); - lexerBuffer[ LEX_BUFFER_MAX-1 ] = 0; - } - else { - ::strncpy( lexerBuffer, yytext, len ); - lexerBuffer[ len ] = 0; - } + ::strlcpy( lexerBuffer, yytext, LEX_BUFFER_MAX ); yylval->str = lexerBuffer; BEGIN(INITIAL); return GEOMSPEC; @@ -205,15 +197,7 @@ iddot [a-zA-Z][a-zA-Z0-9\.]* {string} { /* strip the quotes */ - int len = ::strlen( yytext ); - if ( len >= LEX_BUFFER_MAX ) { - ::strncpy( lexerBuffer, &(yytext[1]), LEX_BUFFER_MAX ); - lexerBuffer[ LEX_BUFFER_MAX-1 ] = 0; - } - else { - ::strncpy( lexerBuffer, &(yytext[1]), len-2 ); - lexerBuffer[ len-2 ] = 0; - } + ::strlcpy( lexerBuffer, &(yytext[1]), LEX_BUFFER_MAX ); yylval->str = lexerBuffer; return STRING; }