]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
col: use snprintf() instead of sprintf()
authorKarel Zak <kzak@redhat.com>
Tue, 7 Oct 2025 10:12:05 +0000 (12:12 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 7 Oct 2025 11:46:15 +0000 (13:46 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/col.c

index 37654eae5214ba04ca1a8947d3a8e18d5fa6d030..5866d7d0e1a444996e5fc8affc377d7c08c78b65 100644 (file)
@@ -678,7 +678,7 @@ int main(int argc, char **argv)
                                c = getchar();
                                if (c == EOF)
                                        break;
-                               sprintf(buf, "\\x%02x", (unsigned char) c);
+                               snprintf(buf, sizeof(buf), "\\x%02x", (unsigned char) c);
                                len = strlen(buf);
                                for (i = 0; i < len; i++) {
                                        lns.ch = buf[i];