On Fri, Sep 11, 2015 at 12:57:06PM +0200, Patrik Jakobsson wrote: > On Tue, Sep 08, 2015 at 03:36:25AM +0300, Dmitry V. Levin wrote: > > On Mon, Aug 24, 2015 at 02:42:48PM +0200, Patrik Jakobsson wrote: [...] > > > +static char *drm_get_driver_name(struct tcb *tcp) > > > +{ > > > + char path[PATH_MAX]; > > > + char link[PATH_MAX]; > > > + int ret; > > > + > > > + if (getfdpath(tcp, tcp->u_arg[0], path, PATH_MAX - 1) < 0) > > > + return NULL; > > > + > > > + snprintf(link, PATH_MAX, "/sys/class/drm/%s/device/driver", > > > + basename(path)); > > > > if (snprintf(link, sizeof(link), ...) >= sizeof(link)) > > return NULL; > > > > According to manpage snprintf never returns more than the specified size - 1.
Really? "The functions snprintf() and vsnprintf() do not write more than size bytes (including the terminating null byte ('\0')). If the output was truncated due to this limit, then the return value is the number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been available. Thus, a return value of size or more means that the output was truncated." -- ldv
pgpPRvO7kI3Iy.pgp
Description: PGP signature
------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel