summaryrefslogtreecommitdiff
path: root/cgitcgi
diff options
context:
space:
mode:
Diffstat (limited to 'cgitcgi')
-rw-r--r--cgitcgi/ctx.c2
-rw-r--r--cgitcgi/dlist.c2
-rw-r--r--cgitcgi/fatal.c6
-rw-r--r--cgitcgi/git-shared.c2
-rw-r--r--cgitcgi/html.c2
-rw-r--r--cgitcgi/http.c2
-rw-r--r--cgitcgi/repolist.c2
-rw-r--r--cgitcgi/strbuf.c2
-rw-r--r--cgitcgi/system.c2
-rw-r--r--cgitcgi/ui-shared.c4
-rw-r--r--cgitcgi/ui-tree.c6
-rw-r--r--cgitcgi/wrapper.c2
12 files changed, 17 insertions, 17 deletions
diff --git a/cgitcgi/ctx.c b/cgitcgi/ctx.c
index f5f00aa..e789c54 100644
--- a/cgitcgi/ctx.c
+++ b/cgitcgi/ctx.c
@@ -1471,7 +1471,7 @@ static void ctx_relative_html( void )
msize = (int)strlen(ctx.repo.name) + (int)strlen(ctx.repo.relative_path) + 4; /* '/' repo.name '/' relative_path '/' + '\0' */
href = (char *)__sbrk( msize );
- sprintf( href, "/%s/", ctx.repo.name );
+ snprintf( href, msize, "/%s/", ctx.repo.name );
path = (char *)__sbrk( msize );
memcpy( (void *)path, (const void *)ctx.repo.relative_path, length );
diff --git a/cgitcgi/dlist.c b/cgitcgi/dlist.c
index fc91f2b..74b7d3b 100644
--- a/cgitcgi/dlist.c
+++ b/cgitcgi/dlist.c
@@ -18,7 +18,7 @@ void dlist_error( const char *fmt, ... )
{
va_list arg_ptr;
char buf[DLIST_ERRMSG_SIZE];
- char msg[DLIST_ERRMSG_SIZE];
+ char msg[DLIST_ERRMSG_SIZE-8];
char *format = "%s: %s\n";
va_start( arg_ptr, fmt );
diff --git a/cgitcgi/fatal.c b/cgitcgi/fatal.c
index 3a2f72f..4c3318e 100644
--- a/cgitcgi/fatal.c
+++ b/cgitcgi/fatal.c
@@ -34,7 +34,7 @@ void fatal( const char *fmt, ... )
{
va_list arg_ptr;
char buf[HTTP_ERRMSG_SIZE];
- char msg[HTTP_ERRMSG_SIZE];
+ char msg[HTTP_ERRMSG_SIZE-16];
char *format = "%s: %s\n";
va_start( arg_ptr, fmt );
@@ -56,7 +56,7 @@ void fatal_json( const char *fmt, ... )
char resp[HTTP_ERRMSG_SIZE];
char json[HTTP_ERRMSG_SIZE];
- char msg[HTTP_ERRMSG_SIZE];
+ char msg[HTTP_ERRMSG_SIZE-80];
char *http_format = "Status: 500 Internal Server Error\n"
"Date: %s\n"
@@ -87,7 +87,7 @@ void fatal_html( const char *fmt, ... )
char resp[HTTP_ERRMSG_SIZE];
char html[HTTP_ERRMSG_SIZE];
- char msg[HTTP_ERRMSG_SIZE];
+ char msg[HTTP_ERRMSG_SIZE-2048];
char *http_format = "Status: 500 Internal Server Error\n"
"Date: %s\n"
diff --git a/cgitcgi/git-shared.c b/cgitcgi/git-shared.c
index 3c81c42..706510a 100644
--- a/cgitcgi/git-shared.c
+++ b/cgitcgi/git-shared.c
@@ -48,7 +48,7 @@ void cgit_error( const char *fmt, ... )
{
va_list arg_ptr;
char buf[CGIT_ERRMSG_SIZE];
- char msg[CGIT_ERRMSG_SIZE];
+ char msg[CGIT_ERRMSG_SIZE-8];
char *format = "%s: %s\n";
va_start( arg_ptr, fmt );
diff --git a/cgitcgi/html.c b/cgitcgi/html.c
index df50a61..2a931c1 100644
--- a/cgitcgi/html.c
+++ b/cgitcgi/html.c
@@ -38,7 +38,7 @@ void html_error( const char *fmt, ... )
{
va_list arg_ptr;
char buf[HTML_ERRMSG_SIZE];
- char msg[HTML_ERRMSG_SIZE];
+ char msg[HTML_ERRMSG_SIZE-8];
char *format = "%s: %s\n";
va_start( arg_ptr, fmt );
diff --git a/cgitcgi/http.c b/cgitcgi/http.c
index 18828e2..fc04e29 100644
--- a/cgitcgi/http.c
+++ b/cgitcgi/http.c
@@ -170,7 +170,7 @@ void http_error( const char *fmt, ... )
{
va_list arg_ptr;
char buf[HTTP_ERRMSG_SIZE];
- char msg[HTTP_ERRMSG_SIZE];
+ char msg[HTTP_ERRMSG_SIZE-8];
char *format = "%s: %s\n";
va_start( arg_ptr, fmt );
diff --git a/cgitcgi/repolist.c b/cgitcgi/repolist.c
index c0208a0..2a37db3 100644
--- a/cgitcgi/repolist.c
+++ b/cgitcgi/repolist.c
@@ -40,7 +40,7 @@ void rlist_error( const char *fmt, ... )
{
va_list arg_ptr;
char buf[RLIST_ERRMSG_SIZE];
- char msg[RLIST_ERRMSG_SIZE];
+ char msg[RLIST_ERRMSG_SIZE-16];
char *format = "%s: %s\n";
va_start( arg_ptr, fmt );
diff --git a/cgitcgi/strbuf.c b/cgitcgi/strbuf.c
index e336982..6fd65a5 100644
--- a/cgitcgi/strbuf.c
+++ b/cgitcgi/strbuf.c
@@ -111,7 +111,7 @@ void strbuf_fatal( const char *fmt, ... )
{
va_list arg_ptr;
char buf[STRBUF_ERRMSG_SIZE];
- char msg[STRBUF_ERRMSG_SIZE];
+ char msg[STRBUF_ERRMSG_SIZE-16];
char *format = "%s: %s\n";
va_start( arg_ptr, fmt );
diff --git a/cgitcgi/system.c b/cgitcgi/system.c
index afab9a7..737b70a 100644
--- a/cgitcgi/system.c
+++ b/cgitcgi/system.c
@@ -25,7 +25,7 @@ void system_error( const char *fmt, ... )
{
va_list arg_ptr;
char buf[SYSTEM_ERRMSG_SIZE];
- char msg[SYSTEM_ERRMSG_SIZE];
+ char msg[SYSTEM_ERRMSG_SIZE-16];
char *format = "%s: %s\n";
va_start( arg_ptr, fmt );
diff --git a/cgitcgi/ui-shared.c b/cgitcgi/ui-shared.c
index 8a51d0d..cd3cc88 100644
--- a/cgitcgi/ui-shared.c
+++ b/cgitcgi/ui-shared.c
@@ -248,7 +248,7 @@ void cgit_repo_info( struct cgit_info *info, const char *revision )
if( buf.buf[0] )
{
strbuf_trim( &buf );
- strncpy( info->revision, buf.buf, GIT_OID_HEXSZ+1 );
+ strncpy( info->revision, buf.buf, GIT_OID_HEXSZ );
fill_commit_info( info, (const char *)&path[0], NULL );
}
@@ -496,7 +496,7 @@ void cgit_rpath_info( struct cgit_info *info, const char *relative_path, const c
if( buf.buf[0] )
{
strbuf_trim( &buf );
- strncpy( info->revision, buf.buf, GIT_OID_HEXSZ+1 );
+ strncpy( info->revision, buf.buf, GIT_OID_HEXSZ );
fill_commit_info( info, (const char *)&path[0], (const char *)&rpath[0] );
if( info->kind == GIT_OBJECT_BLOB )
{
diff --git a/cgitcgi/ui-tree.c b/cgitcgi/ui-tree.c
index 59f65a1..b5f9225 100644
--- a/cgitcgi/ui-tree.c
+++ b/cgitcgi/ui-tree.c
@@ -772,8 +772,8 @@ static void cgit_print_summary( struct strbuf *sb, const char *relative_path, co
static void cgit_print_clone_urls( struct strbuf *sb, const char *relative_path )
{
- char ref[PATH_MAX] = { 0 };
- char rpath[PATH_MAX] = { 0 };
+ char ref[PATH_MAX-64] = { 0 };
+ char rpath[PATH_MAX] = { 0 };
char branch[PATH_MAX] = { 0 };
if( !sb ) return;
@@ -786,7 +786,7 @@ static void cgit_print_clone_urls( struct strbuf *sb, const char *relative_path
if( !strncmp( (char *)&ref[0], "refs/heads/", 11 ) )
{
b = (const char *)&ref[11];
- sprintf( (char *)&branch[0], "--branch %s -- ", b );
+ snprintf( (char *)&branch[0], PATH_MAX, "--branch %s -- ", b );
}
if( b && !strcmp( b, ctx.repo.trunk ) )
diff --git a/cgitcgi/wrapper.c b/cgitcgi/wrapper.c
index 60c184a..471ef28 100644
--- a/cgitcgi/wrapper.c
+++ b/cgitcgi/wrapper.c
@@ -36,7 +36,7 @@ void wrapper_error( const char *fmt, ... )
{
va_list arg_ptr;
char buf[WRAPPER_ERRMSG_SIZE];
- char msg[WRAPPER_ERRMSG_SIZE];
+ char msg[WRAPPER_ERRMSG_SIZE-16];
char *format = "%s: %s\n";
va_start( arg_ptr, fmt );