diff --git a/src/program.c b/src/program.c
index 65759de03a201fdd78f46f8e820fc1faf606b6af..6ebc01c23ff593f5340f4df47118603c59ee7a69 100644
--- a/src/program.c
+++ b/src/program.c
@@ -1154,7 +1154,7 @@ void my_yyerror(char *fmt,...)
   va_start(args,fmt);
   VSPRINTF(buf,fmt,args);
 
-  if(strlen(buf) >= sizeof(buf))
+  if((long)strlen(buf) >= (long)sizeof(buf))
     fatal("Buffer overflow in my_yyerror.");
 
   yyerror(buf);