lkml.org 
[lkml]   [2007]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch 3/7] add kstrndup
Date
> +	len = strlen(s);
> + if (len > max)
> + len = max;

You can avoid to run beyond max and save two lines by using strnlen:

len = strnlen(s, max);

René

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-05-11 22:55    [W:0.138 / U:0.200 seconds]
©2003-2011 Jasper Spaans. Advertise on this site