Artem Frolov wrote: > Hello, > > I am in the process of testing static defect analyzer on a Linux > kernel source code (see disclosure below). > > I found some potential array bounds violations. The pattern is as > follows: bytes are copied from the user space and then buffer is > accessed on index strlen(buf)-1. This is a defect if user data start > from 0. So the question is: can we make any assumptions what data may > be received from the user or it could be arbitrary? Both are potential problems for someone with CAP_SYS_ADMIN capabilties. Attached are patches for them. > Full disclosure: I am working for Klocwork (http://www.klocwork.com/), > which is a vendor of commercial closed-source proprietary products, > static analyzer for C/C++ is part of its products -- ~Randy