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

Diff for /src/usr.bin/nc/netcat.c between version 1.94 and 1.95

version 1.94, 2009/10/08 15:56:46 version 1.95, 2010/02/27 00:58:56
Line 683 
Line 683 
         unsigned char *p, *end;          unsigned char *p, *end;
         unsigned char obuf[4];          unsigned char obuf[4];
   
         end = buf + size;          if (size < 3)
         obuf[0] = '\0';                  return;
           end = buf + size - 2;
   
         for (p = buf; p < end; p++) {          for (p = buf; p < end; p++) {
                 if (*p != IAC)                  if (*p != IAC)
                         break;                          continue;
   
                 obuf[0] = IAC;                  obuf[0] = IAC;
                 p++;                  p++;
                 if ((*p == WILL) || (*p == WONT))                  if ((*p == WILL) || (*p == WONT))
                         obuf[1] = DONT;                          obuf[1] = DONT;
                 if ((*p == DO) || (*p == DONT))                  else if ((*p == DO) || (*p == DONT))
                         obuf[1] = WONT;                          obuf[1] = WONT;
                 if (obuf) {                  else
                         p++;                          continue;
                         obuf[2] = *p;  
                         obuf[3] = '\0';                  p++;
                         if (atomicio(vwrite, nfd, obuf, 3) != 3)                  obuf[2] = *p;
                                 warn("Write Error!");                  if (atomicio(vwrite, nfd, obuf, 3) != 3)
                         obuf[0] = '\0';                          warn("Write Error!");
                 }  
         }          }
 }  }
   

Legend:
Removed from v.1.94  
changed lines
  Added in v.1.95