user/5011: atomicio incorrectly casts to u_int instead of size_t

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

user/5011: atomicio incorrectly casts to u_int instead of size_t

Ray Lai
>Number:         5011
>Category:       user
>Synopsis:       atomicio incorrectly casts to u_int instead of size_t
>Confidential:   yes
>Severity:       non-critical
>Priority:       medium
>Responsible:    bugs
>State:          open
>Quarter:        
>Keywords:      
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 08 23:30:02 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Ray
>Release:        3.9-beta
>Organization:
net
>Environment:
       
        System      : OpenBSD 3.9
        Architecture: OpenBSD.i386
        Machine     : i386
>Description:
       
atomicio incorrectly casts the read or write results into u_int instead of size_t.

>How-To-Repeat:
       
>Fix:
       
Index: usr.bin/nc/atomicio.c
===================================================================
RCS file: /cvs/src/usr.bin/nc/atomicio.c,v
retrieving revision 1.7
diff -u -r1.7 atomicio.c
--- usr.bin/nc/atomicio.c 26 May 2005 01:01:08 -0000 1.7
+++ usr.bin/nc/atomicio.c 8 Feb 2006 23:07:53 -0000
@@ -57,7 +57,7 @@
  errno = EPIPE;
  return pos;
  default:
- pos += (u_int)res;
+ pos += (size_t)res;
  }
  }
  return pos;
Index: usr.bin/ssh/atomicio.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/atomicio.c,v
retrieving revision 1.13
diff -u -r1.13 atomicio.c
--- usr.bin/ssh/atomicio.c 24 May 2005 17:32:43 -0000 1.13
+++ usr.bin/ssh/atomicio.c 8 Feb 2006 23:07:53 -0000
@@ -54,7 +54,7 @@
  errno = EPIPE;
  return pos;
  default:
- pos += (u_int)res;
+ pos += (size_t)res;
  }
  }
  return (pos);


>Release-Note:
>Audit-Trail:
>Unformatted: