[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 5/5] tools/virtiofsd: xattr name mappings: Simple 'map'
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [PATCH v3 5/5] tools/virtiofsd: xattr name mappings: Simple 'map' |
Date: |
Tue, 20 Oct 2020 12:35:30 +0100 |
User-agent: |
Mutt/1.14.6 (2020-07-11) |
* Stefan Hajnoczi (stefanha@redhat.com) wrote:
> On Wed, Oct 14, 2020 at 07:02:09PM +0100, Dr. David Alan Gilbert (git) wrote:
> > +static XattrMapEntry *parse_xattrmap_map(const char *rule,
> > + XattrMapEntry *map,
> > + size_t *nentries)
> > +{
> > + char sep = *rule++;
> > + const char *tmp;
> > + char *key;
> > + char *prefix;
> > + XattrMapEntry tmp_entry;
> > +
> > + /* At start of 'key' field */
> > + tmp = strchr(rule, sep);
>
> Missing sep == '\0' check. The strchr(3) man page says:
>
> The terminating null byte is considered part of the string, so that if
> c is specified as '\0', these functions return a pointer to the
> terminator.
>
> So the code in this patch will eventually access beyond the end of the
> string:
>
> rule = tmp + 1; <-- tmp is already at the NUL terminator
Ah yes, I've got the check in the main routine but not in the _map case;
OK I'll fix that up.
Dave
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
- Re: [PATCH v3 1/5] tools/virtiofsd: xattr name mappings: Add option, (continued)
- [PATCH v3 2/5] tools/virtiofsd: xattr name mappings: Map client xattr names, Dr. David Alan Gilbert (git), 2020/10/14
- [PATCH v3 3/5] tools/virtiofsd: xattr name mappings: Map server xattr names, Dr. David Alan Gilbert (git), 2020/10/14
- [PATCH v3 5/5] tools/virtiofsd: xattr name mappings: Simple 'map', Dr. David Alan Gilbert (git), 2020/10/14
- [PATCH v3 4/5] tools/virtiofsd: xattr name mapping examples, Dr. David Alan Gilbert (git), 2020/10/14
- Re: [PATCH v3 4/5] tools/virtiofsd: xattr name mapping examples, Stefan Hajnoczi, 2020/10/20
- Re: [PATCH v3 4/5] tools/virtiofsd: xattr name mapping examples, Vivek Goyal, 2020/10/20
- Re: [PATCH v3 4/5] tools/virtiofsd: xattr name mapping examples, Dr. David Alan Gilbert, 2020/10/20
- Re: [PATCH v3 4/5] tools/virtiofsd: xattr name mapping examples, Vivek Goyal, 2020/10/20
- Re: [PATCH v3 4/5] tools/virtiofsd: xattr name mapping examples, Dr. David Alan Gilbert, 2020/10/20
- Re: [PATCH v3 4/5] tools/virtiofsd: xattr name mapping examples, Vivek Goyal, 2020/10/21
- Re: [PATCH v3 4/5] tools/virtiofsd: xattr name mapping examples, Dr. David Alan Gilbert, 2020/10/21