char signedness
I have attached a patch for selinux-small that makes it work correctly on platforms where the "char" type is unsigned.
This affects ARM, PPC, and S/390. Also the code will not perform correctly on platforms with signed char (such as i386) in the case of character 255.
This closes bug #182170 in the Debian BTS.
Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
libsecure/test/msgget_s.c +3 -3
@@ -31,11 +31,11 @@key_t ipc_key;int ret;security_id_t sid =SECSID_NULL ; -char c; +int c_int;int id; -while ( (c =getopt (argc, argv,"k:c:s:" )) !=EOF ) { -switch (c) { +while ( (c_int =getopt (argc, argv,"k:c:s:" )) !=EOF ) { +switch ((char )c_int) {case 'k' : ipc_key =atoi (optarg); valid_ipc_key =1 ;
Binary files selinux-orig/libsecure/test/msgsnd_s and selinux-small-2003011510/libsecure/test/msgsnd_s differ
libsecure/test/msgsnd_s.c +3 -3
@@ -42,10 +42,10 @@int valid_msg_sid =0 ;char *word, *first_words;int ret; -char c; +int c_int; -while ( (c =getopt (argc, argv,"c:i:s:t:" )) !=EOF ) { -switch (c) { +while ( (c_int =getopt (argc, argv,"c:i:s:t:" )) !=EOF ) { +switch ((char )c_int) {case 's' :if (valid_msg_sid) {fprintf (stderr,"Only a sid or a context may be given, not both\n" );
Binary files selinux-orig/libsecure/test/semget_s and selinux-small-2003011510/libsecure/test/semget_s differ
libsecure/test/semget_s.c +3 -3
@@ -32,11 +32,11 @@key_t ipc_key;int ret;security_id_t sid; -char c; +int c_int;int id; -while ( (c =getopt (argc, argv,"k:c:s:n:" )) !=EOF ) { -switch (c) { +while ( (c_int =getopt (argc, argv,"k:c:s:n:" )) !=EOF ) { +switch ((char )c_int) {case 'k' : ipc_key =atoi (optarg); valid_ipc_key =1 ;
Binary files selinux-orig/libsecure/test/shmget_s and selinux-small-2003011510/libsecure/test/shmget_s differ
libsecure/test/shmget_s.c +3 -3
@@ -32,11 +32,11 @@key_t ipc_key;int err, ret;security_id_t sid =SECSID_NULL ; -char c; +int c_int;int id; -while ( (c =getopt (argc, argv,"k:c:s:b:" )) !=EOF ) { -switch (c) { +while ( (c_int =getopt (argc, argv,"k:c:s:b:" )) !=EOF ) { +switch ((char )c_int) {case 'k' : ipc_key =atoi (optarg); valid_ipc_key =1 ;