untrusted string optimization

Steve Grubb sgrubb at redhat.com
Mon May 16 20:36:42 UTC 2005


Hello,

I was looking at some ascii charts trying to interpret an untrusted string and 
realized something. We have this test in audit_log_untrustedstring() in 
audit.c:

 if (*p == '"' || *p == ' ' || *p < 0x20 || *p > 0x7f) {

It turns out that space is hex 20. So we could have:

 if (*p == '"' || *p < 0x21 || *p > 0x7f) {

and have one less compare in that loop.

-Steve




More information about the Linux-audit mailing list