aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/snowball/compiler/generator.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/snowball/compiler/generator.c')
-rw-r--r--contrib/snowball/compiler/generator.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/contrib/snowball/compiler/generator.c b/contrib/snowball/compiler/generator.c
index eed86c117..44fbdcea4 100644
--- a/contrib/snowball/compiler/generator.c
+++ b/contrib/snowball/compiler/generator.c
@@ -1,4 +1,20 @@
+/*
+ * Copyright 2025 Vsevolod Stakhov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <limits.h> /* for INT_MAX */
#include <stdio.h> /* for fprintf etc */
#include <stdlib.h> /* for free etc */
@@ -1241,7 +1257,7 @@ static void generate_substring(struct generator * g, struct node * p) {
g->I[3] = bitmap;
g->I[4] = shortest_size - 1;
if (p->mode == m_forward) {
- sprintf(buf, "z->p[z->c + %d]", shortest_size - 1);
+ snprintf(buf, sizeof(buf), "z->p[z->c + %d]", shortest_size - 1);
g->S[1] = buf;
if (shortest_size == 1) {
writef(g, "~Mif (z->c >= z->l", p);