aboutsummaryrefslogtreecommitdiff
path: root/sys/netsmb
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2018-01-22 02:08:10 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2018-01-22 02:08:10 +0000
commitd821d36419a2ec7c61435759467139bde2613468 (patch)
treef469fa2de1347fb08ba66d2b41c9cab5eccfe14c /sys/netsmb
parentb8d1747e755f88c678adc272fb4d356715288197 (diff)
downloadsrc-d821d36419a2ec7c61435759467139bde2613468.tar.gz
src-d821d36419a2ec7c61435759467139bde2613468.zip
Unsign some values related to allocation.
When allocating memory through malloc(9), we always expect the amount of memory requested to be unsigned as a negative value would either stand for an error or an overflow. Unsign some values, found when considering the use of mallocarray(9), to avoid unnecessary casting. Also consider that indexes should be of at least the same size/type as the upper limit they pretend to index. MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=328238
Diffstat (limited to 'sys/netsmb')
-rw-r--r--sys/netsmb/smb_crypt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netsmb/smb_crypt.c b/sys/netsmb/smb_crypt.c
index 394b026523a9..27f824cf88bf 100644
--- a/sys/netsmb/smb_crypt.c
+++ b/sys/netsmb/smb_crypt.c
@@ -118,7 +118,7 @@ smb_ntencrypt(const u_char *apwd, u_char *C8, u_char *RN)
u_char S21[21];
u_int16_t *unipwd;
MD4_CTX *ctxp;
- int len;
+ u_int len;
len = strlen(apwd);
unipwd = malloc((len + 1) * sizeof(u_int16_t), M_SMBTEMP, M_WAITOK);
@@ -148,7 +148,7 @@ smb_calcmackey(struct smb_vc *vcp)
{
const char *pwd;
u_int16_t *unipwd;
- int len;
+ u_int len;
MD4_CTX md4;
u_char S16[16], S21[21];