public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] TFTP: add host ip addr support
Date: Wed, 16 Jan 2008 21:40:25 +0100	[thread overview]
Message-ID: <20080116204025.C2919242EC@gemini.denx.de> (raw)
In-Reply-To: Your message of "Wed, 16 Jan 2008 15:27:50 EST." <478E68C6.8070309@gmail.com>

In message <478E68C6.8070309@gmail.com> you wrote:
>
> > But I diaagree about strncpy because you need to known the size of
> > the string and we know it only when we use the default_filename otherwise
> > we need to strlen and in this strcpy do every thing itself.
> >
> >   
> strncpy copies AT MOST 'n' bytes.

...and doesn't necessarily NUL-terminate.

> #define MAX_FILE_NAME_LEN 80
> static char tftp_filename[MAX_FILE_NAME_LEN];
> 
> strncpy(tftp_filename, str, MAX_FILE_NAME_LEN);
> 
> Standard buffer overrun protection.

...only if you make sure that tftp_filename[] gets terminated
independent of the length; otherwise you fix the problem when writing
the srting but create one when reading it.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Every program has at least one bug and can be shortened by  at  least
one instruction - from which, by induction, one can deduce that every
program can be reduced to one instruction which doesn't work.

  reply	other threads:[~2008-01-16 20:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-11 23:43 [U-Boot-Users] [PATCH] TFTP: add host ip addr support Jean-Christophe PLAGNIOL-VILLARD
2008-01-15 13:50 ` Jean-Christophe PLAGNIOL-VILLARD
2008-01-16  3:19 ` Ben Warren
2008-01-16  7:19   ` Jean-Christophe PLAGNIOL-VILLARD
2008-01-16 15:49     ` Ben Warren
2008-01-16 17:33       ` Jean-Christophe PLAGNIOL-VILLARD
2008-01-16 20:27         ` Ben Warren
2008-01-16 20:40           ` Wolfgang Denk [this message]
2008-01-16 20:47             ` Ben Warren
2008-01-16 20:56               ` McMullan, Jason
2008-01-16 21:26                 ` Wolfgang Denk
2008-01-16 22:27                   ` Jean-Christophe PLAGNIOL-VILLARD
2008-01-16 23:09                     ` Wolfgang Denk
2008-01-16 23:33                       ` Ben Warren
2008-01-17 22:08                         ` [U-Boot-Users] [PATCH 0/1] " Jean-Christophe PLAGNIOL-VILLARD
2008-01-17 22:08                           ` [U-Boot-Users] [PATCH 1/1] Fix nfs command help to reflect that the serverip is optional Jean-Christophe PLAGNIOL-VILLARD
2008-01-17 22:29                             ` Ben Warren
2008-01-17 22:31                           ` [U-Boot-Users] [PATCH 0/1] TFTP: add host ip addr support Wolfgang Denk
2008-01-17 22:42                           ` Andre Renaud
2008-01-18  0:19                             ` Ben Warren
2008-01-18  0:30                             ` Jean-Christophe PLAGNIOL-VILLARD
2008-01-16 21:23               ` [U-Boot-Users] [PATCH] " Wolfgang Denk
2008-01-16 21:38                 ` Ben Warren
2008-01-17 23:51                 ` Jean-Christophe PLAGNIOL-VILLARD
2008-01-18  0:14                   ` Jean-Christophe PLAGNIOL-VILLARD
2008-02-04 23:42                     ` Wolfgang Denk
2008-01-18  0:23                   ` Ben Warren
  -- strict thread matches above, loose matches on Subject: below --
2007-12-24 15:55 Jean-Christophe PLAGNIOL-VILLARD
2007-12-24 16:40 ` Jerry Van Baren
2007-12-26 20:42 ` Haavard Skinnemoen
2007-12-26 23:09   ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080116204025.C2919242EC@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox