On Thursday 02 April 2009 04:49, Guenter wrote: > Hi Denys, > Denys Vlasenko schrieb: > > Patch is damaged by linewrapping. > > Please send as attachment next time, not inline. > I did both, also as attachment. > > >> - xlseek(fd, f->header.e_shoff, SEEK_SET); > >> - xread(fd, section_headers, sizeof(ElfW(Shdr)) * shnum); > >> + if (memimg_size < (f->header.e_shoff + sizeof(ElfW(Shdr)) * shnum)) > > > > bug in the line above. > hmm, its late here, and brobably I'm actually blind and / or braindead, > can you please point to?
I was wrong, lots of ()'s fooled me. :) I thought it's (a + b) * c, but it's not. > >> + else > >> + m_image = xmalloc_open_read_close(m_filename, &len); > >> + if (!m_image) > >> return EXIT_FAILURE; > > > > Why do you do it this way at all? Can this work instead? - > > > > size_t len = MAXINT(ssize_t); > > void *image = xmalloc_open_zipped_read_close(filename, &len); > if xmalloc_open_zipped_read_close() does work with both gzipped and > non-compressed files then sure - just I assumed the function will only > work with gzipped files. IIRC it will. > >> m_name = xstrdup(bb_basename(m_filename)); > >> - p = strrchr(m_name, '.'); > >> + p = strchr(m_name, '.'); > > > > Why? > when we search from the rear then we catch only the last one, f.e.: > module.o.gz -> module.o > it was though my inmpression that we need here the module name only > without any extension, and unless its valid to have module names with > dots this should work: > module.o.gz -> module Makes sense. Perhaps a comment will be useful: /* "module.o[.gz]" -> "module" */ You can do it simpler btw: - p = strrchr(m_name, '.'); + *strchrnul(m_name, '.') = '\0'; -- vda _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
