http://bugzilla.novell.com/show_bug.cgi?id=536500 Summary: sarg-2.2.5-46.17: bad call to snprintf and file operations wrong order Classification: openSUSE Product: openSUSE 11.2 Version: Factory Platform: All OS/Version: openSUSE 11.1 Status: NEW Severity: Normal Priority: P5 - None Component: Other AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: dcb314@hotmail.com QAContact: qa@suse.de Found By: --- I just had a look at factory package sarg-2.2.5-46.17 1. For source code file sarg-2.2.5/useragent.c around line 100, function useragent is the following code snprintf(msg, sizeof(buf), " %s: %ld",text[10],totregsl); but char msg[1024]; and char buf[MAXLEN]; #define MAXLEN 20000 so it seems that the second parameter of the call to snprintf is out of range. Suggest new code snprintf( msg, sizeof msg, " %s: %ld", text[10], totregsl); 2. It seems that some actions on local variable fp_ou are out of order.
From the command line
$ fgrep fp_ou ../BUILD/sarg-2.2.5/useragent.c FILE *fp_in = NULL, *fp_ou = NULL, *fp_ht = NULL; if((fp_ou=fopen(tmp3,"w"))==NULL) { fputs(buf,fp_ou); fclose(fp_ou); fputs(html,fp_ou); // BAD. You can't write to a closed file fclose(fp_ou); // BAD. You can't close something already closed if((fp_ou=fopen(tmp2,"w"))==NULL) { fputs(html,fp_ou); fputs(html,fp_ou); fclose(fp_ou); Suggest rearrange the source code into a more reasonable order. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.