summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2012-12-13 13:56:53 +0100
committerportix <portix@gmx.net>2012-12-13 13:56:53 +0100
commit1ec3aeb3f9c8bd88e8e0405b1e048fe17fb2ffab (patch)
tree5383a9af68ceaed5b4afe72c3da04b94fc3c5bf5 /tools
parent134534d19053da93c75e9fb63177c218285955f5 (diff)
downloaddwb-1ec3aeb3f9c8bd88e8e0405b1e048fe17fb2ffab.zip
Fixing format-security errors
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile2
-rw-r--r--tools/dwbem.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 8564fa79..d1fe8a48 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -12,7 +12,7 @@ SYSTEM_EXTENSION_DIR=$(PREFIX)/share/dwb/extensions
CFLAGS := $(CFLAGS)
CFLAGS += -std=c99
CFLAGS += -Wall -g
-CFLAGS += -Wextra
+CFLAGS += -Wextra -Werror=format-security
CFLAGS += $(shell pkg-config --cflags $(LIBS))
CFLAGS += -DSYSTEM_EXTENSION_DIR=\"$(SYSTEM_EXTENSION_DIR)\"
diff --git a/tools/dwbem.c b/tools/dwbem.c
index 27624c17..3b9f932f 100644
--- a/tools/dwbem.c
+++ b/tools/dwbem.c
@@ -291,7 +291,7 @@ update_installed(const char *name, const char *meta)
char *
xreadline(char *buffer, size_t length, const char *prompt) {
for (;;) {
- fprintf(stdout, prompt);
+ fputs(prompt, stderr);
if (isatty(STDIN_FILENO))
tcflush(STDIN_FILENO, TCIFLUSH);
if (fgets(buffer, length, stdin)) {
@@ -363,8 +363,8 @@ get_response(char *buffer, size_t length, const char *format, ...)
}
int
-create_tmp(char *buffer, int size, char *template, int suffix_length) {
- snprintf(buffer, size, template);
+create_tmp(char *buffer, int size, const char *template, int suffix_length) {
+ strncpy(buffer, template, size);
int fd = mkstemps(buffer, suffix_length);
if (fd == -1)
die(1, "Cannot create temporary file");
@@ -842,7 +842,7 @@ do_update(const char *meta, int flags)
char *space = strchr(meta, ' ');
if (space != NULL)
{
- snprintf(buffer, MIN(sizeof(buffer), (unsigned int)(space - meta + 1)), meta);
+ strncpy(buffer, meta, MIN(sizeof(buffer), (unsigned int)(space - meta + 1)));
if ((flags & F_NO_CONFIRM) || yes_no(1, "Update "EXT(%s), buffer))
if (cl_install(buffer, flags | F_UPDATE))
notify(EXT(%s)" successfully updated", buffer);
@@ -1091,7 +1091,7 @@ main(int argc, char **argv)
fprintf(stderr, "Unknown option %s\n", argv[1]);
else
fprintf(stderr, "%s\n", missing ? "" : e->message);
- fprintf(stderr, g_option_context_get_help(ctx, false, NULL));
+ fputs(g_option_context_get_help(ctx, false, NULL), stderr);
return 1;
}