diff options
| author | Linus Torvalds <[email protected]> | 2009-11-18 22:31:52 +0100 | 
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2009-11-18 17:18:13 -0800 | 
| commit | a414f01ac2899f273ef8fe98fa44158ac12793f2 (patch) | |
| tree | 30a7ef8d7d2f8d4aca0781fa8785630fc1f6320d /lib/kref.c | |
| parent | 6602b355c2cf8f4c628732827408606075288d28 (diff) | |
strcmp: fix overflow and possibly signedness error
Doing the strcmp return value as
	signed char __res = *cs - *ct;
is wrong for two reasons.  The subtraction can overflow because __res
doesn't use a type big enough.  Moreover the compared bytes should be
interpreted as unsigned char as specified by POSIX.
The same problem is fixed in strncmp.
Signed-off-by: Uwe Kleine-König <[email protected]>
Cc: Michael Buesch <[email protected]>
Cc: Andreas Schwab <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/kref.c')
0 files changed, 0 insertions, 0 deletions