Skip to content

Commit

Permalink
Fix: showing of error messages segfaults because va_list not derefere…
Browse files Browse the repository at this point in the history
…nced
  • Loading branch information
positively-charged committed Sep 6, 2015
1 parent 7ff0a85 commit add74e2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,10 @@ void t_diag_args( struct task* task, int flags, va_list* args ) {
void show_diag( struct task* task, int flags, va_list* args ) {
if ( flags & DIAG_FILE ) {
const char* file = NULL;
int line = 0, column = 0;
decode_pos( task, va_arg( args, struct pos* ), &file, &line,
&column );
int line = 0;
int column = 0;
struct pos* pos = va_arg( *args, struct pos* );
decode_pos( task, pos, &file, &line, &column );
printf( "%s", file );
if ( flags & DIAG_LINE ) {
printf( ":%d", line );
Expand Down Expand Up @@ -309,8 +310,10 @@ void log_diag( struct task* task, int flags, va_list* args ) {
}
if ( flags & DIAG_FILE ) {
const char* file = NULL;
int line = 0, column = 0;
decode_pos( task, va_arg( *args, struct pos* ), &file, &line, &column );
int line = 0;
int column = 0;
struct pos* pos = va_arg( *args, struct pos* );
decode_pos( task, pos, &file, &line, &column );
fprintf( task->err_file, "%s:", file );
if ( flags & DIAG_LINE ) {
// For some reason, DB2 decrements the line number by one. Add one to
Expand Down

0 comments on commit add74e2

Please sign in to comment.