Thanks, Lucas.

Here's another patch (gzipped and uuencoded) that adds more security
checks when parsing
LS_COLORS environment variable. Without it, List will segfault for some
(illegal) values of LS_COLORS
(try setting LS_COLORS="a", you should be able to reproduce the bug).

begin 644 list_colors_security.patch.gz
M'XL("(6F]T@"`VQI<W1?8V]L;W)S7W-E8W5R:71Y+G!A=&-H`)54?V_;-A#]
MN_H45P^H)5-R)#MQ;6LI4G1&%\!S@"0%"J2%H,AT0E06/5)*VJWY[CN2^F79
MP%#"D&3R[GCOW;OS/`]&P]GPU./BX42*Y&3)9#Y,7HU\?^H%ON>[EMAIL PROTECTED],Q_[\
M;#STJP7$QW.+$&*<CSD&$_#?SD]'\_'HP/'[EMAIL PROTECTED]<'%AP6]KNF$9
MA0]7RZOK:'GY\<_;Z./U8K&*/ES]L8#>[EMAIL PROTECTED]"\63;@XZU,HC^>O\9U`HF
MS>GB\^UB=7-YM:I/86J1_9OP9+&ZO;Y<W,!896AA=)F+(LDAX2D748JPX%]+
M.2>/L0"@WW.:2<:SN[WX7T,-*SB=NB,$%IS.W/%$0Y,TC]9,Z'#2=JPR&LMR
M8*'E58$'-'MR]3-*^.X'?N;\&\W4UM]%G$;**+1(VQS.8?5IN6QY-3O'G-6U
M^F%\'[EMAIL PROTECTED]>;)[RYM(DW'3<TP^;`/V:V7D8*ZDO0$_?ZK7G?\5SL^A_\7O.R4<
M7"<#*"0%Y#<NTI(_"8.3ZMS<6AY'J8R,A<GK92^["@R68EWL;)5*V,J\V=:&
M3KB?I?'&5`T(?6B`X-I1(;BP>R9&K_3%]<!S#IN8I6;GQ2+ZC:@27F"QLF)[
M3P7P#0;-!:,22ZCB,\&S+6[!4RQ8?)_2*F#-:[EMAIL PROTECTED]'6"5_3-6SC[VQ;;%N!
M*@>[JTD'U8;ZDQ#C#V2\H?D/V`F:Q$6."APJ<HDAK5%KE-(,.0I,+?6A%H/A
M#3_M1F.]>:\D]OF1I11LNV-JU*3,'$?'.[B*D)I!50!".IF\.S]H-:=RP'4O
M:/PMM%H@)-YN'_;@P$'FTI0GMF3_4+XY-'[EMAIL PROTECTED],FMQ&:$88*W]%HIP82MQ(]K
M(RCMBFM?(!W%;[EMAIL PROTECTED]'>?@@,?N]D$0(A3-VK!\3TS)WB?)A-W-%,SX>Z>?J:
M^SYD_!GE(B%_I,VT<>&[EMAIL PROTECTED];_5;FKN:%.[G`5M0Q>8
M$T*)PSN"N;[EMAIL PROTECTED]"?TS27:99TG?5SV,4"[EMAIL PROTECTED]/+,B%>O
M)\[6.+*VN^JB8X)F=2'0$/]C%"T'$]V%7Y)%2[$8K2W(_]&@2;*:#TE*XZS8
MS6MVU'QZ\T:/J=='9EU]44VM"\T@;]-<EZ+K879=Z(S\RE?0O!"9_J>D:C([
9X-(W&+2B2PPHZA?5AJH6UG_?V&*C&[EMAIL PROTECTED]
`
end

  ----- Original Message -----
  From: "Lucas C. Villa Real"
  To: gobolinux-devel@lists.gobolinux.org
  Subject: Re: [gobolinux-devel] A new try...
  Date: Thu, 9 Oct 2008 02:25:15 -0300


  On Sun, Oct 5, 2008 at 3:04 PM, David Karell wrote:
  > Seems something went wrong, so I'll try to send the patch in
  plaintext
  > instead (it's pretty small)
  >
  > diff -Naur Scripts.orig/2.9.4/src/List.c Scripts/2.9.4/src/List.c
  > --- Scripts.orig/2.9.4/src/List.c 2008-07-31 02:30:04.000000000
  +0200
  > +++ Scripts/2.9.4/src/List.c 2008-10-05 01:27:22.000000000 +0200
  > @@ -30,6 +30,10 @@
  > #include
  > #define MAJOR(x) (long long) major(x)
  > #define MINOR(x) (long long) minor(x)
  > +#elif defined(__FreeBSD__)
  > + #include
  > + #define MAJOR(x) (long long) major(x)
  > + #define MINOR(x) (long long) minor(x)
  > #else
  > #include
  > #include
  > @@ -700,9 +704,10 @@
  > exit(EXIT_FAILURE);
  > }
  >
  > -char *
  > -get_filesystem(struct statfs status)
  > +char const *
  > +get_filesystem(struct statfs *status)
  > {
  > +#ifndef __FreeBSD__
  > int i;
  > struct fs_info fs_info[] = {
  > { ADFS_SUPER_MAGIC, "adfs" },
  > @@ -755,11 +760,17 @@
  > };
  >
  > for (i = 0; i < sizeof(fs_info)/sizeof(struct fs_info); ++i) {
  > - if (status.f_type == fs_info[i].magic)
  > + if (status->f_type == fs_info[i].magic)
  > return fs_info[i].name;
  > }
  >
  > return "filesystem";
  > +#else
  > + /* Those magic numbers don't work on FreeBSD.
  > + OTOH, the statfs struct on that platform
  > + has a convenient filesystem name in cleartext. */
  > + return status->f_fstypename;
  > +#endif
  > }
  >
  > void
  > @@ -817,11 +828,11 @@
  >
  > if (hiddenfiles) {
  > printf("\n%s in %ld%s+%ld%s files - %s: %s%s kB used (%02.0f%%),
  %s%s
  > kB free\n", bytes_total_string,
  > - counter, COLOR_GREY_CODE, hiddenfiles, COLOR_WHITE_CODE,
  > get_filesystem(status),
  > + counter, COLOR_GREY_CODE, hiddenfiles, COLOR_WHITE_CODE,
  > get_filesystem(&status),
  > bytes_used_string, COLOR_WHITE_CODE, percent,
  > bytes_free_string, COLOR_WHITE_CODE);
  > } else {
  > printf("\n%s in %ld files - %s: %s%s kB used (%02.0f%%), %s%s kB
  > free\n", bytes_total_string, counter,
  > - get_filesystem(status), bytes_used_string, COLOR_WHITE_CODE,
  > percent, bytes_free_string,
  > + get_filesystem(&status), bytes_used_string, COLOR_WHITE_CODE,
  > percent, bytes_free_string,
  > COLOR_WHITE_CODE);
  > }
  >

  Thanks for the patch, it was just merged to the SVN.

  Regards,
  Lucas
  _______________________________________________
  gobolinux-devel mailing list
  gobolinux-devel@lists.gobolinux.org
  http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel

-- 
Be Yourself @ mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com

_______________________________________________
gobolinux-devel mailing list
gobolinux-devel@lists.gobolinux.org
http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel

Reply via email to