Coverity fixes
[claws.git] / src / matcher_parser_lex.l
index c12c1ca340eda69d73ffa833f4e90b1d2f813c06..209e50373a714358821ffb5738bdb2ac0fe524b6 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -16,8 +16,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #include <string.h>
 #include "codeconv.h"
 #include "matcher.h"
 #include "matcher_parser_lex.h"
+
 #ifndef YYSTYPE
 #include "matcher_parser_parse.h"
 #endif
-#define MAX_STR_CONST 512
+
+#define MAX_STR_CONST 8192
 
 static char string_buf[MAX_STR_CONST];
 static char *string_buf_ptr;
@@ -88,7 +90,7 @@ void matcher_parser_init(void)
                if (!g_utf8_validate(string_buf, -1, NULL)) {
                        gchar *tmp = conv_codeset_strdup(string_buf, conv_get_locale_charset_str(), CS_INTERNAL);
                        if (tmp) {
-                               strcpy(string_buf, tmp);
+                               g_strlcpy(string_buf, tmp, sizeof(string_buf));
                                g_free(tmp);
                        }
                }
@@ -102,7 +104,7 @@ void matcher_parser_init(void)
 <string>.      {
                add_char(yytext[0]);
                }
-\[[^\[\]]*\]   {
+^\[.*\]$       {
                 /* for section name in configuration file */
                BEGIN(0);
                yylval.str = yytext + 1;