diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1997-12-09 07:57:43 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1997-12-09 07:57:43 +0000 |
commit | eded21a00a253859f474c1bcca5d418a3c82948f (patch) | |
tree | 94e38e1e18679c1a1a5af56a04c549d26eb42255 /kerberosIV/krb/str2key.c | |
parent | 49ac4cb4369b59297c067ed22daacd240c981029 (diff) |
Removed one expliotable hole, one possibly exploitable hole, many buffer
overflows and lots of unchecked pointers. Tags are nice too.
Diffstat (limited to 'kerberosIV/krb/str2key.c')
-rw-r--r-- | kerberosIV/krb/str2key.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kerberosIV/krb/str2key.c b/kerberosIV/krb/str2key.c index 8e967a63610..8aebe070afd 100644 --- a/kerberosIV/krb/str2key.c +++ b/kerberosIV/krb/str2key.c @@ -1,3 +1,4 @@ +/* $OpenBSD: str2key.c,v 1.5 1997/12/09 07:57:39 art Exp $ */ /* $KTH: str2key.c,v 1.10 1997/03/23 03:53:19 joda Exp $ */ /* This defines the Andrew string_to_key function. It accepts a password @@ -11,7 +12,7 @@ static void mklower(char *s) { - for (; *s; s++) + for (; s[0] != '\0'; s++) if ('A' <= *s && *s <= 'Z') *s = *s - 'A' + 'a'; } @@ -26,10 +27,11 @@ afs_cmu_StringToKey (char *str, char *cell, des_cblock *key) int i; int passlen; - memset (key, 0, sizeof(key)); + memset(key, 0, sizeof(key)); memset(password, 0, sizeof(password)); strncpy (password, cell, 8); + password[8] = '\0'; passlen = strlen (str); if (passlen > 8) passlen = 8; @@ -70,6 +72,7 @@ afs_transarc_StringToKey (char *str, char *cell, des_cblock *key) int passlen; strncpy (password, str, sizeof(password)); + password[sizeof(password)-1] = '\0'; if ((passlen = strlen (password)) < sizeof(password)-1) strncat (password, cell, sizeof(password)-passlen); if ((passlen = strlen(password)) > sizeof(password)) passlen = sizeof(password); |