Date: Tue, 3 Jul 2001 01:18:08 -0400 From: Garance A Drosihn <drosih@rpi.edu> To: freebsd-print@bostonradio.org Cc: freebsd-audit@FreeBSD.org Subject: Re: Initial ctlinfo, for checking incoming jobs to lpd Message-ID: <p0510100db7670146e46d@[128.113.24.47]> In-Reply-To: <p0510100db760298f4bb4@[128.113.24.47]> References: <p0510100db760298f4bb4@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
At 8:49 PM -0400 6/27/01, Garance A Drosihn wrote: >The following patch would add a new source file to lpr/common_source, >called ctlinfo.c. While I have several plans for ctlinfo.c, this >first cut just replaces calls to link & unlink in lpd/recvjob.c >with a call to a new routine which does a whole bunch of work. For those playing at home, the patch also includes a subtle but probably dangerous bug. (it does happen to work fine, until you try to print debugging messages on some other platforms...). Down where I have: >+ sroom = roundup(sizeof(struct cjprivate), 8); >+ sroom2 = sroom + strlen(cfname) + 1; >+ sroom2 = roundup(sroom2, 8); >+ msize = sroom2 + CTI_LINEMAX; >+ msize = roundup(msize, 8); >+ cpriv = (struct cjprivate *)malloc(msize); >+ if (cpriv == NULL) >+ return NULL; >+ memset(cpriv, 0, msize); >+ >+ cpriv->pub.cji_fname = (char *)(cpriv + sroom); >+ strcpy(cpriv->pub.cji_fname, cfname); >+ cpriv->cji_buff = (char *)(cpriv + sroom2); >+ cpriv->cji_eobuff = (char *)(cpriv + msize - 1); The three lines where I add offsets to cpriv are wrong. They should be: + cpriv->pub.cji_fname = (char *)cpriv + sroom; + strcpy(cpriv->pub.cji_fname, cfname); + cpriv->cji_buff = (char *)cpriv + sroom2; + cpriv->cji_eobuff = (char *)cpriv + msize - 1; I haven't refreshed the patch-files that I posted earlier, as I'm still in the middle of testing. But I thought I would mention this in case anyone else was running the patch. [reminder: this patch has not been committed to anywhere yet, so no need to panic...] -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p0510100db7670146e46d>