[Patch] miss use of isdigit in httpd/src/support/logresolve.c

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

[Patch] miss use of isdigit in httpd/src/support/logresolve.c

Daniel Ouellet
Hi,

In redoing my previous sent patch, I found this miss use of the isdigit
macro based on all the email exchanged done on the subject in the last
few days.

I have attach the patch for it if you agree with the finding.

In that function, (main()), the line[] is already define as char, but
looks like it was cast to (int) instead of (unsigned char) like it
should have been. Here is the variable definition in that function.

int main (int argc, char *argv[])
{
     struct in_addr ipnum;
     char *bar, hoststring[MAXDNAME + 1], line[MAXLINE], *statfile;
....

So, this patch should restore the proper use.

Thanks

Daniel

----------------------------------

Index: logresolve.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/src/support/logresolve.c,v
retrieving revision 1.10
diff -u -r1.10 logresolve.c
--- logresolve.c 27 Mar 2005 20:35:49 -0000 1.10
+++ logresolve.c 1 Apr 2006 02:25:52 -0000
@@ -297,7 +297,7 @@
  if (line[0] == '\0')
     continue;
  entries++;
- if (!isdigit((int)line[0])) { /* short cut */
+ if (!isdigit((unsigned char)line[0])) { /* short cut */
     puts(line);
     withname++;
     continue;