-const char cgi_rcs[] = "$Id: cgi.c,v 1.114 2008/12/04 18:15:04 fabiankeil Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.115 2009/03/01 18:28:23 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
*
* Revisions :
* $Log: cgi.c,v $
+ * Revision 1.115 2009/03/01 18:28:23 fabiankeil
+ * Help clang understand that we aren't dereferencing
+ * NULL pointers here.
+ *
* Revision 1.114 2008/12/04 18:15:04 fabiankeil
* Fix some cparser warnings.
*
* Read the file, ignoring comments, and honoring #include
* statements, unless we're already called recursively.
*
- * FIXME: The comment handling could break with lines >BUFFER_SIZE long.
- * This is unlikely in practise.
+ * XXX: The comment handling could break with lines lengths > sizeof(buf).
+ * This is unlikely in practise.
*/
- while (fgets(buf, BUFFER_SIZE, fp))
+ while (fgets(buf, sizeof(buf), fp))
{
if (!recursive && !strncmp(buf, "#include ", 9))
{
char buf[BUFFER_SIZE];
char *tmp_out_buffer;
char *file_buffer;
- size_t size;
+ size_t size;
int error;
const char *flags;
* character and allow backreferences ($1 etc) in the
* "replace with" text.
*/
- snprintf(buf, BUFFER_SIZE, "%s", m->name + 1);
+ snprintf(buf, sizeof(buf), "%s", m->name + 1);
flags = "sigU";
}
else
flags = "sigTU";
/* Enclose name in @@ */
- snprintf(buf, BUFFER_SIZE, "@%s@", m->name);
+ snprintf(buf, sizeof(buf), "@%s@", m->name);
}
-
log_error(LOG_LEVEL_CGI, "Substituting: s/%s/%s/%s", buf, m->value, flags);
/* Make and run job. */