summaryrefslogtreecommitdiff
path: root/kerberosIV/krb/get_default_principal.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>1997-12-09 07:57:43 +0000
committerArtur Grabowski <art@cvs.openbsd.org>1997-12-09 07:57:43 +0000
commiteded21a00a253859f474c1bcca5d418a3c82948f (patch)
tree94e38e1e18679c1a1a5af56a04c549d26eb42255 /kerberosIV/krb/get_default_principal.c
parent49ac4cb4369b59297c067ed22daacd240c981029 (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/get_default_principal.c')
-rw-r--r--kerberosIV/krb/get_default_principal.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kerberosIV/krb/get_default_principal.c b/kerberosIV/krb/get_default_principal.c
index 01054df3167..a2569e306c2 100644
--- a/kerberosIV/krb/get_default_principal.c
+++ b/kerberosIV/krb/get_default_principal.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: get_default_principal.c,v 1.2 1997/12/09 07:57:16 art Exp $ */
/* $KTH: get_default_principal.c,v 1.10 1997/04/01 08:18:28 joda Exp $ */
/*
@@ -66,8 +67,9 @@ krb_get_default_principal(char *name, char *instance, char *realm)
return -1;
}
- strcpy(name, pw->pw_name);
- strcpy(instance, "");
+ strncpy(name, pw->pw_name, ANAME_SZ);
+ name[ANAME_SZ-1] = '\0';
+ strncpy(instance, "", 2);
krb_get_lrealm(realm, 1);
if(strcmp(name, "root") == 0){
@@ -80,7 +82,7 @@ krb_get_default_principal(char *name, char *instance, char *realm)
if(p){
strncpy (name, p, ANAME_SZ);
name[ANAME_SZ - 1] = '\0';
- strcpy(instance, "root");
+ strncpy(instance, "root", 5);
}
}
return 1;