comparison input/input.c @ 37169:2c223acee2db

Ensure isprint only gets input it can handle. Patch by [spunit262 gmail.com].
author reimar
date Thu, 04 Sep 2014 18:54:16 +0000
parents 0caa0bf428b9
children
comparison
equal deleted inserted replaced
37168:04f2b82fc98f 37169:2c223acee2db
1470 for(i = 0; key_names[i].name != NULL; i++) { 1470 for(i = 0; key_names[i].name != NULL; i++) {
1471 if(key_names[i].key == key) 1471 if(key_names[i].key == key)
1472 return key_names[i].name; 1472 return key_names[i].name;
1473 } 1473 }
1474 1474
1475 if(isprint(key)) { 1475 if(0 <= key && key <= 255 && isprint(key)) {
1476 snprintf(key_str,12,"%c",(char)key); 1476 snprintf(key_str,12,"%c",(char)key);
1477 return key_str; 1477 return key_str;
1478 } 1478 }
1479 1479
1480 // Print the hex key code 1480 // Print the hex key code