Received: by taz.hyperreal.com (8.6.12/8.6.5) id OAA26102; Mon, 22 Apr 1996 14:16:00 -0700 Received: from fully.organic.com by taz.hyperreal.com (8.6.12/8.6.5) with ESMTP id OAA26097; Mon, 22 Apr 1996 14:15:58 -0700 Received: (from brian@localhost) by fully.organic.com (8.6.12/8.6.12) id VAA05307; Mon, 22 Apr 1996 21:19:28 GMT Date: Mon, 22 Apr 1996 14:19:28 -0700 (PDT) From: Brian Behlendorf To: new-httpd@hyperreal.com cc: new-httpd@hyperreal.com Subject: Re: host truncation bug seems to be in mod_cookies.c In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-new-httpd@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com D'oh! from mod_cookies.c: void make_cookie(request_rec *r) { struct timeval tv; char new_cookie[100]; /* blurgh */ char *dot; const char *rname = get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME); struct timezone tz = { 0 , 0 }; if ((dot = strchr(rname,'.'))) *dot='\0'; /* First bit of hostname */ gettimeofday(&tv, &tz); sprintf(new_cookie,"%s%s%d%ld%d; path=/", COOKIE_NAME, rname, (int)getpid(), (long)tv.tv_sec, (int)tv.tv_usec/1000 ); table_set(r->headers_out,"Set-Cookie",new_cookie); return; } get_remote_host returns a pointer directly into the conn structure, so the strchr truncates it. Eeek. Should it be fixed by having the subroutine do a pstrdup, or should get_remote_host return a copy of the string instead? I think the former, something might depend on the behavior of the latter.... Brian --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-- brian@organic.com | We're hiring! http://www.organic.com/Home/Info/Jobs/