smb_subr.c (107940) | smb_subr.c (109623) |
---|---|
1/* 2 * Copyright (c) 2000-2001 Boris Popov 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * | 1/* 2 * Copyright (c) 2000-2001 Boris Popov 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * |
32 * $FreeBSD: head/sys/netsmb/smb_subr.c 107940 2002-12-16 16:20:06Z robert $ | 32 * $FreeBSD: head/sys/netsmb/smb_subr.c 109623 2003-01-21 08:56:16Z alfred $ |
33 */ 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/endian.h> 37#include <sys/kernel.h> 38#include <sys/malloc.h> 39#include <sys/proc.h> 40#include <sys/lock.h> --- 44 unchanged lines hidden (view full) --- 85 86char * 87smb_strdup(const char *s) 88{ 89 char *p; 90 int len; 91 92 len = s ? strlen(s) + 1 : 1; | 33 */ 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/endian.h> 37#include <sys/kernel.h> 38#include <sys/malloc.h> 39#include <sys/proc.h> 40#include <sys/lock.h> --- 44 unchanged lines hidden (view full) --- 85 86char * 87smb_strdup(const char *s) 88{ 89 char *p; 90 int len; 91 92 len = s ? strlen(s) + 1 : 1; |
93 p = malloc(len, M_SMBSTR, M_WAITOK); | 93 p = malloc(len, M_SMBSTR, 0); |
94 if (s) 95 bcopy(s, p, len); 96 else 97 *p = 0; 98 return p; 99} 100 101/* --- 9 unchanged lines hidden (view full) --- 111 if (copyin(p, &bt, 1)) 112 return NULL; 113 len++; 114 if (maxlen && len > maxlen) 115 return NULL; 116 if (bt == 0) 117 break; 118 } | 94 if (s) 95 bcopy(s, p, len); 96 else 97 *p = 0; 98 return p; 99} 100 101/* --- 9 unchanged lines hidden (view full) --- 111 if (copyin(p, &bt, 1)) 112 return NULL; 113 len++; 114 if (maxlen && len > maxlen) 115 return NULL; 116 if (bt == 0) 117 break; 118 } |
119 p = malloc(len, M_SMBSTR, M_WAITOK); | 119 p = malloc(len, M_SMBSTR, 0); |
120 copyin(s, p, len); 121 return p; 122} 123 124/* 125 * duplicate memory block from a user space. 126 */ 127void * 128smb_memdupin(void *umem, int len) 129{ 130 char *p; 131 132 if (len > 8 * 1024) 133 return NULL; | 120 copyin(s, p, len); 121 return p; 122} 123 124/* 125 * duplicate memory block from a user space. 126 */ 127void * 128smb_memdupin(void *umem, int len) 129{ 130 char *p; 131 132 if (len > 8 * 1024) 133 return NULL; |
134 p = malloc(len, M_SMBSTR, M_WAITOK); | 134 p = malloc(len, M_SMBSTR, 0); |
135 if (copyin(umem, p, len) == 0) 136 return p; 137 free(p, M_SMBSTR); 138 return NULL; 139} 140 141/* 142 * duplicate memory block in the kernel space. 143 */ 144void * 145smb_memdup(const void *umem, int len) 146{ 147 char *p; 148 149 if (len > 8 * 1024) 150 return NULL; | 135 if (copyin(umem, p, len) == 0) 136 return p; 137 free(p, M_SMBSTR); 138 return NULL; 139} 140 141/* 142 * duplicate memory block in the kernel space. 143 */ 144void * 145smb_memdup(const void *umem, int len) 146{ 147 char *p; 148 149 if (len > 8 * 1024) 150 return NULL; |
151 p = malloc(len, M_SMBSTR, M_WAITOK); | 151 p = malloc(len, M_SMBSTR, 0); |
152 if (p == NULL) 153 return NULL; 154 bcopy(umem, p, len); 155 return p; 156} 157 158void 159smb_strfree(char *s) --- 201 unchanged lines hidden --- | 152 if (p == NULL) 153 return NULL; 154 bcopy(umem, p, len); 155 return p; 156} 157 158void 159smb_strfree(char *s) --- 201 unchanged lines hidden --- |