use alloc_ref rather than hand-allocating "struct ref"
[gitweb.git] / grep.c
diff --git a/grep.c b/grep.c
index b58c7c64342698737f9c11b20457bd30ca1fc727..6c68d5bd2e33536407788a6a2fb87f1adce6f89c 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -306,9 +306,9 @@ static NORETURN void compile_regexp_failed(const struct grep_pat *p,
        char where[1024];
 
        if (p->no)
-               sprintf(where, "In '%s' at %d, ", p->origin, p->no);
+               xsnprintf(where, sizeof(where), "In '%s' at %d, ", p->origin, p->no);
        else if (p->origin)
-               sprintf(where, "%s, ", p->origin);
+               xsnprintf(where, sizeof(where), "%s, ", p->origin);
        else
                where[0] = 0;