Project

General

Profile

Bug #5076

-Wsecurity/-Wformat issues reported when compiling zfs(8) with clang on FreeBSD

Added by Garrett Cooper over 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2014-08-10
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

Saw these issues pop up when compiling zfs(8) on FreeBSD with clang.

- The printf warnings can be easily fixed by adding "%s" to the printf calls.

/usr/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/cmd/zfs/zfs_main.c:5022:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
(void) printf(*title_ptr++);
^~~~~~~~~~
/usr/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/cmd/zfs/zfs_main.c:5077:20: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
(void) printf(title);
^~~
/usr/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/cmd/zfs/zfs_main.c:5134:17: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
(void) printf(dsname);
^~~~

- The %c should be changed to %s as "-o" is a string literal, not a single char:

/usr/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/cmd/zfs/zfs_main.c:5885:7: warning: format specifies type 'int' but the argument has type 'char *' [-Wformat]
"-o", MNT_LINE_MAX);
^~~~

No data to display

Also available in: Atom PDF