diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2023-03-03 03:12:24 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2023-03-03 14:49:14 +1100 |
commit | 93291bd723959adf462b1df958106cf07a7734dd (patch) | |
tree | 58634fad8d21def16996650e9d86ddff530b06e3 /scp.c | |
parent | e37261dff33af23f37202cfce0848d36f5c1055c (diff) | |
download | openssh-git-93291bd723959adf462b1df958106cf07a7734dd.tar.gz |
upstream: Check return values of dup2. Spotted by Coverity, ok djm@
OpenBSD-Commit-ID: 19fb1b53072826d00c67df677731d2f6c1dd602b
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.252 2023/01/10 23:22:15 millert Exp $ */ +/* $OpenBSD: scp.c,v 1.253 2023/03/03 03:12:24 dtucker Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -394,8 +394,10 @@ do_cmd2(char *host, char *remuser, int port, char *cmd, /* Fork a child to execute the command on the remote host using ssh. */ pid = fork(); if (pid == 0) { - dup2(fdin, 0); - dup2(fdout, 1); + if (dup2(fdin, 0) == -1) + perror("dup2"); + if (dup2(fdout, 1) == -1) + perror("dup2"); replacearg(&args, 0, "%s", ssh_program); if (port != -1) { |