libvirt/src/storage
Eric Blake 768007aedc maint: don't permit format strings without %
Any time we have a string with no % passed through gettext, a
translator can inject a % to cause a stack overread.  When there
is nothing to format, it's easier to ask for a string that cannot
be used as a formatter, by using a trivial "%s" format instead.

In the past, we have used --disable-nls to catch some of the
offenders, but that doesn't get run very often, and many more
uses have crept in.  Syntax check to the rescue!

The syntax check can catch uses such as
virReportError(code,
               _("split "
                 "string"));
by using a sed script to fold context lines into one pattern
space before checking for a string without %.

This patch is just mechanical insertion of %s; there are probably
several messages touched by this patch where we would be better
off giving the user more information than a fixed string.

* cfg.mk (sc_prohibit_diagnostic_without_format): New rule.
* src/datatypes.c (virUnrefConnect, virGetDomain)
(virUnrefDomain, virGetNetwork, virUnrefNetwork, virGetInterface)
(virUnrefInterface, virGetStoragePool, virUnrefStoragePool)
(virGetStorageVol, virUnrefStorageVol, virGetNodeDevice)
(virGetSecret, virUnrefSecret, virGetNWFilter, virUnrefNWFilter)
(virGetDomainSnapshot, virUnrefDomainSnapshot): Add %s wrapper.
* src/lxc/lxc_driver.c (lxcDomainSetBlkioParameters)
(lxcDomainGetBlkioParameters): Likewise.
* src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML)
(virDomainDiskDefParseXML, virDomainGraphicsDefParseXML):
Likewise.
* src/conf/network_conf.c (virNetworkDNSHostsDefParseXML)
(virNetworkDefParseXML): Likewise.
* src/conf/nwfilter_conf.c (virNWFilterIsValidChainName):
Likewise.
* src/conf/nwfilter_params.c (virNWFilterVarValueCreateSimple)
(virNWFilterVarAccessParse): Likewise.
* src/libvirt.c (virDomainSave, virDomainSaveFlags)
(virDomainRestore, virDomainRestoreFlags)
(virDomainSaveImageGetXMLDesc, virDomainSaveImageDefineXML)
(virDomainCoreDump, virDomainGetXMLDesc)
(virDomainMigrateVersion1, virDomainMigrateVersion2)
(virDomainMigrateVersion3, virDomainMigrate, virDomainMigrate2)
(virStreamSendAll, virStreamRecvAll)
(virDomainSnapshotGetXMLDesc): Likewise.
* src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopReqLeaseDel)
(virNWFilterDHCPSnoopReq): Likewise.
* src/openvz/openvz_driver.c (openvzUpdateDevice): Likewise.
* src/openvz/openvz_util.c (openvzKBPerPages): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Likewise.
* src/qemu/qemu_command.c (qemuBuildHubDevStr, qemuBuildChrChardevStr)
(qemuBuildCommandLine): Likewise.
* src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/rpc/virnetsaslcontext.c (virNetSASLSessionGetIdentity):
Likewise.
* src/rpc/virnetsocket.c (virNetSocketNewConnectUNIX)
(virNetSocketSendFD, virNetSocketRecvFD): Likewise.
* src/storage/storage_backend_disk.c
(virStorageBackendDiskBuildPool): Likewise.
* src/storage/storage_backend_fs.c
(virStorageBackendFileSystemProbe)
(virStorageBackendFileSystemBuild): Likewise.
* src/storage/storage_backend_rbd.c
(virStorageBackendRBDOpenRADOSConn): Likewise.
* src/storage/storage_driver.c (storageVolumeResize): Likewise.
* src/test/test_driver.c (testInterfaceChangeBegin)
(testInterfaceChangeCommit, testInterfaceChangeRollback):
Likewise.
* src/vbox/vbox_tmpl.c (vboxListAllDomains): Likewise.
* src/xenxs/xen_sxpr.c (xenFormatSxprDisk, xenFormatSxpr):
Likewise.
* src/xenxs/xen_xm.c (xenXMConfigGetUUID, xenFormatXMDisk)
(xenFormatXM): Likewise.
2012-07-26 14:32:30 -06:00
..
parthelper.c Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_disk.c maint: don't permit format strings without % 2012-07-26 14:32:30 -06:00
storage_backend_disk.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_fs.c maint: don't permit format strings without % 2012-07-26 14:32:30 -06:00
storage_backend_fs.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_iscsi.c Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_iscsi.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_logical.c Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_logical.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_mpath.c Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_mpath.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_rbd.c maint: don't permit format strings without % 2012-07-26 14:32:30 -06:00
storage_backend_rbd.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_scsi.c Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_scsi.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_sheepdog.c Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend_sheepdog.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend.c Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_backend.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00
storage_driver.c maint: don't permit format strings without % 2012-07-26 14:32:30 -06:00
storage_driver.h Desert the FSF address in copyright 2012-07-23 10:50:50 +08:00