Skip to content

Commit

Permalink
fix bug #135 (magic number)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolinh committed May 30, 2012
1 parent a4e786f commit e74e250
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/extern.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
#define CYAN 36
#define WHITE 37

/* html color code length (type of #FF0000, etc.) without the # */
#define HTMLCOLORCODELENGTH 6

struct conf {
int chead; /* color used for the header */
int clow; /* color when usage low */
Expand Down
4 changes: 2 additions & 2 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,11 +872,11 @@ chk_html_colorcode(char *color)
{
int i;

if (strlen(color) != 6)
if (strlen(color) != HTMLCOLORCODELENGTH)
return -1;
/* NOTREACHED */

for (i = 0; i < 6; i++)
for (i = 0; i < HTMLCOLORCODELENGTH; i++)
if (isxdigit(color[i]) == 0)
return -1;
/* NOTREACHED */
Expand Down

0 comments on commit e74e250

Please sign in to comment.