From: megacz Date: Mon, 7 Apr 2008 03:14:25 +0000 (-0400) Subject: v1.04 fix potential segfault X-Git-Tag: 1.04 X-Git-Url: https://git.hcoop.net/hcoop/debian/libnss-afs.git/commitdiff_plain/abfd757bc51a9d7befdf1a0da59ba568af87b071 v1.04 fix potential segfault --- diff --git a/debian/changelog b/debian/changelog index 8385505..1e05f4c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +libnss-afs (1.04) unstable; urgency=medium + + * librx expects to be able to mutate the char*'s we pass it so strcpy() + the name argument in ptsnametoid(). + + -- megacz Sun, 06 Apr 2008 23:09:46 -0400 + libnss-afs (1.03) unstable; urgency=low * factor out fill_result_buf() to eliminate an extra call to the ptserver diff --git a/nss_afs.c b/nss_afs.c index 3ef57b9..2d6eaf4 100644 --- a/nss_afs.c +++ b/nss_afs.c @@ -78,6 +78,7 @@ #define MAX_OLDPAG_GID 0xff00 #define MAXCELLNAMELEN 256 +#define MAXUSERNAMELEN 256 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; @@ -156,6 +157,7 @@ enum nss_status ptsname2id(char *name, uid_t* uid) { int res; idlist lid; namelist lnames; + char uname[MAXUSERNAMELEN]; init_afs(); @@ -168,7 +170,9 @@ enum nss_status ptsname2id(char *name, uid_t* uid) { lid.idlist_val = 0; lid.idlist_len = 0; - lnames.namelist_val = (prname*)name; + lnames.namelist_val = (prname*)uname; + // apparently ubik expects to be able to modify this? + strncpy(uname, name, MAXUSERNAMELEN); lnames.namelist_len = 1; if (ubik_Call(PR_NameToID,pruclient,0,&lnames,&lid) != PRSUCCESS) {