On Sat, 17. Nov 17:25 Michael Gilbert <mgilb...@debian.org> wrote:
> Hi,
> 
> I've just reviewed this, and it looks mostly good.  I did notice
> things like the following:
> 
> +     FILE *f;
> ++    char path[1024];
> ++    sprintf(path, "%s/%s", getenv("HOME"), ".etw/etw.cfg" );
> +     D(bug("Reading configuration...\n"/*-*/));
> 
> Note that a hardcoded 1024 isn't very portable.  C defines PATH_MAX
> for this purpose.  Please use that instead.
 
Hi Michael,

thanks for taking the time to review the changes. Indeed the author of
etw already checks for PATH_MAX in etw.c and stores the result in
TEMP_DIR. On the other hand he uses 1024 bytes for the buffer at most
and truncates the rest if it exceeds this limit. You can find the
relevant part at line 800 and the following lines in menu.c.

Thanks for pointing this out. I've changed the code accordingly.

+--- a/etw/menu_config.c
++++ b/etw/menu_config.c
+@@ -392,9 +392,16 @@ void load_config(FILE *f)
+ void read_menu_config(void)
+ {
+     FILE *f;
++    char path[1024];
++    snprintf(path, 1024, "%setw.cfg", TEMP_DIR);
++
+     D(bug("Reading configuration...\n"/*-*/));
+ 
+-    f=fopen("etw.cfg"/*-*/,"r");
++    f=fopen(path/*-*/,"r");
++
++    if (f == NULL) {
++      f=fopen("etw.cfg"/*-*/,"r");
++    }


I've uploaded the new version to mentors.debian.net and attached the complete 
debdiff to
bug report #693244. 

Regards,

Markus

Attachment: signature.asc
Description: Digital signature

Reply via email to