bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add support for SD/MMC storage cards on Linux


From: Harald Welte
Subject: Re: [PATCH] Add support for SD/MMC storage cards on Linux
Date: Thu, 18 Sep 2008 10:50:46 +0800
User-agent: Mutt/1.5.18 (2008-05-17)

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 <address@hidden>           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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]