On Thu, 2009-05-21 at 13:01 +0100, Alan Jenkins wrote: > On 5/18/09, Andreas Robinson <andr345@xxxxxxxxx> wrote: > > The easy way is if next_string() checks the terminator, prints a warning > > if it's missing, and returns NULL, i.e finds no strings at all. > > > > OTOH, the program wouldn't exactly refuse anything in this case, just > > misbehave. I will write up a patch that actually makes it stop and > > complain. > > The version you've posted now implements "just misbehave". Did you > change your mind? Yes kind of. I realized we wouldn't want load_strings() to be fatal in modinfo and depmod when they are processing several modules. OTOH, it is possible to have it both ways ... I'll add an errfn_t parameter or something and let it be decided at the callsite whether an error in load_strings() is fatal or not. > + if (*(strings + size - 1) != '\0') { > + error("Ignoring malformed section %s in %s ", > + " - the last string terminator is missing.\n", > + secname, module->pathname); > + return NULL; > + } > > From my point of view, the easiest way is to make the error message a > fatal() one. I would prefer not to "be lenient in what you accept" > when loading code into the kernel :-). You mean like Linus? ;-) fatal("This module is TOTAL CRAP. There is a string without a terminator in it and that IS NOT VALID."); > Thanks again for working on this And I appreciate the feedback from you and Jon. When you get the chance to do something "the right way" instead of picking the first solution that pops up because that's all there is time for, you get better at what you're doing, I think. So this is a good way for me to hone my skills and do something useful at the same time. -- To unsubscribe from this list: send the line "unsubscribe linux-modules" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html