On Wed, Sep 17, 2008 at 02:49:54PM +0200, Jim Meyering wrote:
 
> While we wait for the copyright paperwork to go through,
> it'd be nice for me if you'd resubmit the patches in
> "git format-patch" form.  

I'm familiar with format-patch, no problem ;)
 
> > +                snprintf (id, sizeof(id, -1), "%s",
> 
> I presume that should be "sizeof(id) - 1".

yes, thanks for spotting this.  Surprised that it compiled this way ;)
 
> > +                          _("Generic SD/MMC Storage Card"));
> > +        }
> > +        return init_generic(dev, id);
> > +}
> 
> Also, you might want to use asprintf in place of snprintf.
> Then you don't have to worry about pathologically long type+name
> being truncated.

the underlying SDCard CID data structure has 6 bytes max for name, and type can
only be SD or MMC.  The kernel also uses only an 8 byte buffer for the name.

So using a 127 byte buffer and ensuring that snprintf doesn't write out of
the string buffer should be enough safeguard.  But anyway, I'll use asprintf()
in the next patch.

-- 
- Harald Welte <[EMAIL PROTECTED]>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)

Attachment: signature.asc
Description: Digital signature

_______________________________________________
bug-parted mailing list
bug-parted@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-parted

Reply via email to