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

Diff for /src/usr.bin/ssh/Attic/bufaux.c between version 1.43 and 1.48

version 1.43, 2006/07/22 20:48:22 version 1.48, 2010/02/02 22:49:34
Line 37 
Line 37 
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */   */
   
 #include "includes.h"  #include <sys/types.h>
   
 #include <openssl/bn.h>  #include <openssl/bn.h>
   
 #include <string.h>  #include <string.h>
   #include <stdarg.h>
   
 #include "bufaux.h"  
 #include "xmalloc.h"  #include "xmalloc.h"
   #include "buffer.h"
 #include "log.h"  #include "log.h"
 #include "misc.h"  #include "misc.h"
   
Line 163 
Line 164 
         u_int len;          u_int len;
   
         /* Get the length. */          /* Get the length. */
         len = buffer_get_int(buffer);          if (buffer_get_int_ret(&len, buffer) != 0) {
                   error("buffer_get_string_ret: cannot extract length");
                   return (NULL);
           }
         if (len > 256 * 1024) {          if (len > 256 * 1024) {
                 error("buffer_get_string_ret: bad string length %u", len);                  error("buffer_get_string_ret: bad string length %u", len);
                 return (NULL);                  return (NULL);
Line 177 
Line 181 
                 return (NULL);                  return (NULL);
         }          }
         /* Append a null character to make processing easier. */          /* Append a null character to make processing easier. */
         value[len] = 0;          value[len] = '\0';
         /* Optionally return the length of the string. */          /* Optionally return the length of the string. */
         if (length_ptr)          if (length_ptr)
                 *length_ptr = len;                  *length_ptr = len;
Line 191 
Line 195 
   
         if ((ret = buffer_get_string_ret(buffer, length_ptr)) == NULL)          if ((ret = buffer_get_string_ret(buffer, length_ptr)) == NULL)
                 fatal("buffer_get_string: buffer error");                  fatal("buffer_get_string: buffer error");
           return (ret);
   }
   
   void *
   buffer_get_string_ptr_ret(Buffer *buffer, u_int *length_ptr)
   {
           void *ptr;
           u_int len;
   
           if (buffer_get_int_ret(&len, buffer) != 0)
                   return NULL;
           if (len > 256 * 1024) {
                   error("buffer_get_string_ptr: bad string length %u", len);
                   return NULL;
           }
           ptr = buffer_ptr(buffer);
           buffer_consume(buffer, len);
           if (length_ptr)
                   *length_ptr = len;
           return (ptr);
   }
   
   void *
   buffer_get_string_ptr(Buffer *buffer, u_int *length_ptr)
   {
           void *ret;
   
           if ((ret = buffer_get_string_ptr_ret(buffer, length_ptr)) == NULL)
                   fatal("buffer_get_string_ptr: buffer error");
         return (ret);          return (ret);
 }  }
   

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.48