[BACK]Return to msg.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/msg.c between version 1.19 and 1.20

version 1.19, 2020/06/24 15:08:53 version 1.20, 2020/10/18 11:32:01
Line 45 
Line 45 
         u_char buf[5];          u_char buf[5];
         u_int mlen = sshbuf_len(m);          u_int mlen = sshbuf_len(m);
   
         debug3("%s: type %u", __func__, (unsigned int)type & 0xff);          debug3_f("type %u", (unsigned int)type & 0xff);
   
         put_u32(buf, mlen + 1);          put_u32(buf, mlen + 1);
         buf[4] = type;          /* 1st byte of payload is mesg-type */          buf[4] = type;          /* 1st byte of payload is mesg-type */
         if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) {          if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) {
                 error("%s: write: %s", __func__, strerror(errno));                  error_f("write: %s", strerror(errno));
                 return (-1);                  return (-1);
         }          }
         if (atomicio(vwrite, fd, sshbuf_mutable_ptr(m), mlen) != mlen) {          if (atomicio(vwrite, fd, sshbuf_mutable_ptr(m), mlen) != mlen) {
                 error("%s: write: %s", __func__, strerror(errno));                  error_f("write: %s", strerror(errno));
                 return (-1);                  return (-1);
         }          }
         return (0);          return (0);
Line 71 
Line 71 
   
         if (atomicio(read, fd, buf, sizeof(buf)) != sizeof(buf)) {          if (atomicio(read, fd, buf, sizeof(buf)) != sizeof(buf)) {
                 if (errno != EPIPE)                  if (errno != EPIPE)
                         error("%s: read header: %s", __func__, strerror(errno));                          error_f("read header: %s", strerror(errno));
                 return (-1);                  return (-1);
         }          }
         msg_len = get_u32(buf);          msg_len = get_u32(buf);
         if (msg_len > sshbuf_max_size(m)) {          if (msg_len > sshbuf_max_size(m)) {
                 error("%s: read: bad msg_len %u", __func__, msg_len);                  error_f("read: bad msg_len %u", msg_len);
                 return (-1);                  return (-1);
         }          }
         sshbuf_reset(m);          sshbuf_reset(m);
         if ((r = sshbuf_reserve(m, msg_len, &p)) != 0) {          if ((r = sshbuf_reserve(m, msg_len, &p)) != 0) {
                 error("%s: buffer error: %s", __func__, ssh_err(r));                  error_fr(r, "reserve");
                 return -1;                  return -1;
         }          }
         if (atomicio(read, fd, p, msg_len) != msg_len) {          if (atomicio(read, fd, p, msg_len) != msg_len) {
                 error("%s: read: %s", __func__, strerror(errno));                  error_f("read: %s", strerror(errno));
                 return (-1);                  return (-1);
         }          }
         return (0);          return (0);

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20