Re: [PATCH v2] btrfs-progs: fix segfault when listing column OTIME on big endian host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> btrfs-list.c:
>         case BTRFS_LIST_OTIME:
>                 if (subv->otime)
>                         strftime(tstr, 256, "%Y-%m-%d %X",
>                                  localtime(&subv->otime));
>                 else
>                         strcpy(tstr, "-");
>                 printf("%s", tstr);
>                 break;
> 
> localtime() returned NULL then strftime() got SIGSEGV.
> 
> The reason is that ri->otime.sec is stored as little endian but
> assigned to 't' without conversion.

That's why localtime() returned null, sure, but it doesn't excuse
strftime() being called with a null *tm!  Add some error checking around
localtime().  It should warn that otime is nonsense, not crash.

- z
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux