57b5969b4f
xzgv is a picture viewer for X, with a thumbnail-based file selector. It uses GTK+ and Imlib. Most file formats are supported, and the thumbnails used are compatible with xv, zgv, and the Gimp. It can also be used with `xzgv file(s)', to effectively bypass the file selector. From Julian Leyh <oenone@oenone.de>
80 lines
2.2 KiB
Plaintext
80 lines
2.2 KiB
Plaintext
$OpenBSD: patch-src_filedetails_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
|
|
--- src/filedetails.c.orig Sat Nov 18 18:58:39 2000
|
|
+++ src/filedetails.c Thu May 12 15:32:46 2005
|
|
@@ -26,7 +26,7 @@ static char buf[10];
|
|
int f,shift,submode;
|
|
char *execptr;
|
|
|
|
-strcpy(buf,"---------");
|
|
+strlcpy(buf,"---------",sizeof(buf));
|
|
|
|
for(f=0,shift=6;f<3;f++,shift-=3)
|
|
{
|
|
@@ -73,14 +73,14 @@ char *ptr;
|
|
|
|
if((ptr=strrchr(filename,'/'))==NULL)
|
|
{
|
|
- strcpy(buf,".xvpics/");
|
|
- strcat(buf,filename);
|
|
+ strlcpy(buf,".xvpics/",sizeof(buf));
|
|
+ strlcat(buf,filename,sizeof(buf));
|
|
}
|
|
else
|
|
{
|
|
- strcpy(buf,filename);
|
|
- strcpy(strrchr(buf,'/')+1,".xvpics/");
|
|
- strcat(buf,ptr+1);
|
|
+ strlcpy(buf,filename,sizeof(buf));
|
|
+ strlcat(buf,".xvpics/",sizeof(buf));
|
|
+ strlcat(buf,ptr+1,sizeof(buf));
|
|
}
|
|
|
|
if((tn=fopen(buf,"rb"))!=NULL)
|
|
@@ -174,11 +174,11 @@ DO_TBL_LEFT(os_tbl,tbl_row,"Filename:");
|
|
DO_TBL_RIGHT(os_tbl,tbl_row,filename);
|
|
tbl_row++;
|
|
|
|
-strcpy(buf,"unknown");
|
|
+strlcpy(buf,"unknown",sizeof(buf));
|
|
|
|
DO_TBL_LEFT(os_tbl,tbl_row,"Size:");
|
|
if(got_stat_info)
|
|
- sprintf(buf,"%d (%dk)",(int)sbuf.st_size,((int)sbuf.st_size+1023)/1024);
|
|
+ snprintf(buf,sizeof(buf),"%d (%dk)",(int)sbuf.st_size,((int)sbuf.st_size+1023)/1024);
|
|
DO_TBL_RIGHT(os_tbl,tbl_row,buf);
|
|
tbl_row++;
|
|
|
|
@@ -186,9 +186,9 @@ DO_TBL_LEFT(os_tbl,tbl_row,"Last modifie
|
|
if(got_stat_info)
|
|
{
|
|
if((ctime=localtime(&sbuf.st_mtime))==NULL) /* can't happen? */
|
|
- strcpy(buf,"unknown");
|
|
+ strlcpy(buf,"unknown",sizeof(buf));
|
|
else
|
|
- sprintf(buf,"%d-%02d-%02d %02d:%02d",
|
|
+ snprintf(buf,sizeof(buf),"%d-%02d-%02d %02d:%02d",
|
|
1900+ctime->tm_year,ctime->tm_mon+1,ctime->tm_mday,
|
|
ctime->tm_hour,ctime->tm_min);
|
|
}
|
|
@@ -197,7 +197,7 @@ tbl_row++;
|
|
|
|
DO_TBL_LEFT(os_tbl,tbl_row,"Permissions:");
|
|
if(got_stat_info)
|
|
- sprintf(buf,"%s (%o)",
|
|
+ snprintf(buf,sizeof(buf),"%s (%o)",
|
|
make_perms_string(sbuf.st_mode&07777),sbuf.st_mode&07777);
|
|
DO_TBL_RIGHT(os_tbl,tbl_row,buf);
|
|
tbl_row++;
|
|
@@ -232,9 +232,9 @@ tbl_row=0;
|
|
|
|
DO_TBL_LEFT(tn_tbl,tbl_row,"Dimensions:");
|
|
if(got_dimensions)
|
|
- sprintf(buf,"%d x %d",w,h);
|
|
+ snprintf(buf,sizeof(buf),"%d x %d",w,h);
|
|
else
|
|
- strcpy(buf,"unknown");
|
|
+ strlcpy(buf,"unknown",sizeof(buf));
|
|
DO_TBL_RIGHT(tn_tbl,tbl_row,buf);
|
|
tbl_row++;
|
|
|