diff options
author | 2014-07-01 17:33:51 +0000 | |
---|---|---|
committer | 2014-07-01 17:33:51 +0000 | |
commit | 1c3788d48c9de38f1d08bbad8236363c75abbd49 (patch) | |
tree | b5edc2e9aa477f944515a6b6bbeaa899546ffc0e | |
parent | KASSERT() the correct node if a hint is passed to rn_delete(). (diff) | |
download | wireguard-openbsd-1c3788d48c9de38f1d08bbad8236363c75abbd49.tar.xz wireguard-openbsd-1c3788d48c9de38f1d08bbad8236363c75abbd49.zip |
Fix snprintf() return value tests. ok gilles@
-rw-r--r-- | usr.sbin/smtpd/table_passwd.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/table_sqlite.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/smtpd/table_passwd.c b/usr.sbin/smtpd/table_passwd.c index 14193561362..203fad644f5 100644 --- a/usr.sbin/smtpd/table_passwd.c +++ b/usr.sbin/smtpd/table_passwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_passwd.c,v 1.5 2013/11/18 11:47:16 eric Exp $ */ +/* $OpenBSD: table_passwd.c,v 1.6 2014/07/01 17:33:51 matthieu Exp $ */ /* * Copyright (c) 2013 Gilles Chehade <gilles@poolp.org> @@ -168,7 +168,7 @@ table_passwd_lookup(int service, const char *key, char *dst, size_t sz) switch (service) { case K_CREDENTIALS: if (snprintf(dst, sz, "%s:%s", - pw.pw_name, pw.pw_passwd) > (ssize_t)sz) { + pw.pw_name, pw.pw_passwd) >= (ssize_t)sz) { log_warnx("warn: table-passwd: result too large"); r = -1; } @@ -176,7 +176,7 @@ table_passwd_lookup(int service, const char *key, char *dst, size_t sz) case K_USERINFO: if (snprintf(dst, sz, "%d:%d:%s", pw.pw_uid, pw.pw_gid, pw.pw_dir) - > (ssize_t)sz) { + >= (ssize_t)sz) { log_warnx("warn: table-passwd: result too large"); r = -1; } diff --git a/usr.sbin/smtpd/table_sqlite.c b/usr.sbin/smtpd/table_sqlite.c index 9e8bb08ea36..45015a14b58 100644 --- a/usr.sbin/smtpd/table_sqlite.c +++ b/usr.sbin/smtpd/table_sqlite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_sqlite.c,v 1.12 2014/06/10 16:43:46 gilles Exp $ */ +/* $OpenBSD: table_sqlite.c,v 1.13 2014/07/01 17:33:51 matthieu Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -445,7 +445,7 @@ table_sqlite_lookup(int service, const char *key, char *dst, size_t sz) case K_CREDENTIALS: if (snprintf(dst, sz, "%s:%s", sqlite3_column_text(stmt, 0), - sqlite3_column_text(stmt, 1)) > (ssize_t)sz) { + sqlite3_column_text(stmt, 1)) >= (ssize_t)sz) { log_warnx("warn: table-sqlite: result too large"); r = -1; } @@ -454,7 +454,7 @@ table_sqlite_lookup(int service, const char *key, char *dst, size_t sz) if (snprintf(dst, sz, "%d:%d:%s", sqlite3_column_int(stmt, 0), sqlite3_column_int(stmt, 1), - sqlite3_column_text(stmt, 2)) > (ssize_t)sz) { + sqlite3_column_text(stmt, 2)) >= (ssize_t)sz) { log_warnx("warn: table-sqlite: result too large"); r = -1; } |