diff options
author | okan | 2014-09-11 16:06:26 +0000 |
---|---|---|
committer | okan | 2014-09-11 16:06:26 +0000 |
commit | 84082493cb81b61f9b42cf9528cfe7e29c6594ad (patch) | |
tree | ab6c749fb6dfda5ef00e20c24e5e58d3bb08cc86 /kbfunc.c | |
parent | 35e6d634ac0dcf08d9b4ae737ee7b053e316298a (diff) | |
download | cwm-84082493cb81b61f9b42cf9528cfe7e29c6594ad.tar.gz |
Remove incorrect cast in kbfunc_exec. In kbfunc_ssh, reverse logic on
truncation check so it's obvious.
Diffstat (limited to 'kbfunc.c')
-rw-r--r-- | kbfunc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.100 2014/09/08 20:11:22 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.101 2014/09/11 16:06:26 okan Exp $ */ #include <sys/param.h> @@ -281,8 +281,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg) (void)memset(tpath, '\0', sizeof(tpath)); l = snprintf(tpath, sizeof(tpath), "%s/%s", paths[i], dp->d_name); - /* check for truncation etc */ - if (l == -1 || l >= (int)sizeof(tpath)) + if (l == -1 || l >= sizeof(tpath)) continue; if (access(tpath, X_OK) == 0) menuq_add(&menuq, NULL, "%s", dp->d_name); @@ -373,8 +372,9 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg) goto out; l = snprintf(path, sizeof(path), "%s -T '[ssh] %s' -e ssh %s", cmd->path, mi->text, mi->text); - if (l != -1 && l < sizeof(path)) - u_spawn(path); + if (l == -1 || l >= sizeof(path)) + goto out; + u_spawn(path); } out: if (mi != NULL && mi->dummy) |