diff options
| author | Maxim Sobolev <sobomax@FreeBSD.org> | 2003-11-20 13:36:31 +0000 |
|---|---|---|
| committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2003-11-20 13:36:31 +0000 |
| commit | 9e95548c30eb648b1a3d6ec0b7ebce2f094e4a1b (patch) | |
| tree | 742347ee853e00786b1f1c280a5b073443ff52c1 /libexec | |
| parent | dbf7b3812542c9aa0f33e335978963a133b96a98 (diff) | |
Notes
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/tftpd/tftpd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c index bc247533466c5..6435e8b276f36 100644 --- a/libexec/tftpd/tftpd.c +++ b/libexec/tftpd/tftpd.c @@ -364,8 +364,9 @@ tftp(struct tftphdr *tp, int size) int i, first = 1, has_options = 0, ecode; struct formats *pf; char *filename, *mode, *option, *ccp; + char fnbuf[MAXPATHLEN]; - filename = cp = tp->th_stuff; + cp = tp->th_stuff; again: while (cp < buf + size) { if (*cp == '\0') @@ -376,6 +377,14 @@ again: nak(EBADOP); exit(1); } + i = cp - tp->th_stuff; + if (i >= sizeof(fnbuf)) { + nak(EBADOP); + exit(1); + } + memcpy(fnbuf, tp->th_stuff, i); + fnbuf[i] = '\0'; + filename = fnbuf; if (first) { mode = ++cp; first = 0; |
