debian/0000775000000000000000000000000012261620474007174 5ustar debian/rules0000775000000000000000000000153412261620427010255 0ustar #!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # replace #define macro in astrodienst/src/sweph.h # which defines location of swiss empheris data # this used to be a patch export DEB_CPPFLAGS_MAINT_APPEND = -DSE_EPHE_PATH=\".:/usr/share/libswe/ephe2/:/usr/share/libswe/ephe/\" DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) %: dh $@ --with autoreconf override_dh_auto_configure: dh_auto_configure -- --docdir=\$${prefix}/share/doc/libswe-doc debian/watch0000664000000000000000000000013012236254140010212 0ustar version=3 http://download.gna.org/swissephauto/libswe-(\d+\.\d+\.\d+\.\d+).tar.bz2 debian/libswe-dev.dirs0000664000000000000000000000002412236254140012107 0ustar usr/lib usr/include debian/changelog0000664000000000000000000001303712261620463011050 0ustar libswe (1.80.00.0001-1ubuntu1) trusty; urgency=medium * Use dh-autoreconf to get new libtool macros for ppc64el. -- Logan Rosen Fri, 03 Jan 2014 15:44:19 -0500 libswe (1.80.00.0001-1) unstable; urgency=low * New upstream version 1.80.00 * all libswe0 symbols assumed to have new behavior for 1.80 -- Paul Elliott Sun, 22 Sep 2013 14:07:17 -0500 libswe (1.79.00.0001-1) unstable; urgency=low * all libswe0 symbols have new behavior for 1.79 * replace patch to astrodienst/src/swephexp.h with debian/rules DEB_CPPFLAGS_MAINT_APPEND parameter * harden library swetest against buffer overflow attacks on sprintf * harden swetest agaist buffer format attacks on printf * specify version of swe-basic-data in recommends 1.79 * allow -Werror=format-security -Wformat errors. (closes: #719653) * shorten description. (closes: #681215) * fix dep-3 headers -- Paul Elliott Tue, 20 Aug 2013 15:17:51 -0500 libswe (1.78.00.0001-1) unstable; urgency=low * New upstream version 1.78.00 * update debian/libswe0.symbols * specify version of swe-basic-data in recommends * change copyright because libswe-doc no longer in this source package -- Paul Elliott Mon, 12 Aug 2013 23:54:42 -0500 libswe (1.77.00.0006-1) unstable; urgency=low * Remove libswe-doc package. Will have it's own source package. -- Paul Elliott Sat, 10 Aug 2013 17:29:58 -0500 libswe (1.77.00.0005-7) unstable; urgency=low * Standards-Version: 3.9.4 * debian/compat is 9 * disable these errors -Wno-error=format-security -Wno-format * Multi arch * fix vcs-field-not-canonical -- Paul Elliott Thu, 08 Aug 2013 03:56:34 -0500 libswe (1.77.00.0005-6) unstable; urgency=low * Fix "FTBFS all arches" Don't build docs for arch dependent builds (Closes: #718715) -- Paul Elliott Wed, 07 Aug 2013 13:25:26 -0500 libswe (1.77.00.0005-5) unstable; urgency=low * Fix "FTBFS: Unable to store document to private:stream (ErrCode 3088)" changed src/Makefile.am unoconv --stdout to unoconv -o sleep 20 sec after starting unoconv listner (Closes: #718090) -- Paul Elliott Fri, 02 Aug 2013 17:25:10 -0500 libswe (1.77.00.0005-4) unstable; urgency=low * upgrade to Standards-Version: 3.9.3 * upgrade copyright file to dep-5 -- Paul Elliott Thu, 05 Apr 2012 03:15:09 -0500 libswe (1.77.00.0005-3) unstable; urgency=low * add Vcs fields for collab-maint repository -- Paul Elliott Sat, 03 Mar 2012 15:14:13 -0600 libswe (1.77.00.0005-2) unstable; urgency=low * New upstream release * empty writable home dir for LO (closes: #635672) * Build-Depends-Indep for LO and dependencies -- Paul Elliott Wed, 01 Feb 2012 15:05:52 -0600 libswe (1.77.00.0004-1) unstable; urgency=low * New upstream release * move files to $(pkgdatadir)/ephe/ * upgrade to Standards-Version: 3.9.2 -- Paul Elliott Sat, 14 Jan 2012 00:52:17 -0600 libswe (1.77.00.0003-1) natty; urgency=low * New upstream release * replace openoffice transition packages with libreoffice packages * props needed by new release -- Paul Elliott Sat, 12 Nov 2011 17:50:50 -0600 libswe (1.77.00.0002-2) unstable; urgency=low * location of upstream host moved from berlios to Gna! change docs -- Paul Elliott Wed, 09 Nov 2011 21:37:34 -0600 libswe (1.77.00.0002-1) natty; urgency=low * create separate -doc package. -- Paul Elliott Mon, 03 Oct 2011 21:52:59 -0500 libswe (1.77.00.0001-1) unstable; urgency=low * Initial release (Closes: #635672) <635672 is the bug number of your ITP> * done dh_make much configuring remains to be done. * remove emacsen-* * rename BROKEN to 0. add descriptions. fill in homepage. * remove .la file * new package swe-basic-data * remove init.d.ex, libswe.default.ex * install usr/share/doc/libswe/* * libswe.doc-base pdf and html * Readme.Debian * manpage.3 * libswe.manpage * TODO * ${misc:Depends} added to libswe-dev * move *.ex elsewhere * usb/bin added libswe-dev for asample programs. * libswe-dev.docbase now uses /usr/share/doc/libswe-dev * usr/share/pkgconfig not used in libswe-dev.install * build depends on unoconv * remove LICNESE in copyright * remove upstream INSTALL * libswe-dev.manpages * swetest.c swemini.c are examples * specify them by orignal location. * remove upstream ChangeLog * add swetest.1 swemini.1 manpages * move man pages to swissephauto project * move data files to $(pkgdatadir)/users/ephe/ * patch SE_EPHE_PATH to be a directory that exists! * this is ephepath-fix * add vcs-svn, vcs-browser * control Recommends: swe-basic-data, swe-standard-data * explain multi tar ball source. * openoffice.org-writer, openoffice.org-java-common needed for unoconv work * fix section in control file * create a comment only watch file * increase description verbosity in control file * remove 1st person reference from libswe-dev.doc-base.swisseph * new debian/libswe0.symbols file * move docdir to /usr/share/doc/libswe-dev * insure copyright installed. * make install does not install misc docs debian/docs does instead. -- Paul Elliott Sun, 11 Sep 2011 14:52:56 -0500 debian/compat0000664000000000000000000000000212236254140010365 0ustar 9 debian/.git-dpm0000664000000000000000000000043312236254140010531 0ustar # see git-dpm(1) from git-dpm package 8fa44ee18ad3934d63cac26fca4b2743f1d760d4 8fa44ee18ad3934d63cac26fca4b2743f1d760d4 51c36b2d9994ec4552b24222ab7ea57dd5594de2 51c36b2d9994ec4552b24222ab7ea57dd5594de2 libswe_1.80.00.0001.orig.tar.bz2 9137917da2c5eecc54a78843c1f738bff05a85c4 633609 debian/swe-basic-data.dirs0000664000000000000000000000004712236254140012637 0ustar usr/share/libswe usr/share/libswe/ephe debian/copyright0000664000000000000000000002047612236254140011133 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Swiss Ephemeris AutoTools Source: http://download.gna.org/swissephauto/libswe-1.77.00.astrodocsrc.tar.bz2 Upstream-Contact: Paul Elliott (pelliott@blackpatchpanel.com> Disclaimer: References to the Swiss Ephemeris Professional License, I ignore as I am a free software packager. I rely on the GPL. Comment: On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. Astrodienst is the author of the source files (*.h and *.c) and they deserve the main credit. Files: * Copyright: 2011 Paul Elliott License: GPL-2+ All the files comming from the original Swiss Ephemeris distribution swe_unix_src_X.XX.XX.tar.gz are copyright Dieter Koch and Alois Treindl and are licensed under the GPL version 2 or later as described by the file src/LICENSE. References to the Swiss Ephemeris Professional License, I ignore as I am a free software packager. I rely on the GPL. All the other files, (mostly having to do with autotools building or packaging), Are Copyright Paul Elliott 2011 and are licensed under the GPL version 2 or later which is included below. . The files swephprg.doc swisseph.doc are also copyright Dieter Koch and Alois an licensed under the GPL version 2 or later as described by the file src/LICENSE as confirmed by confirm-copywrite.email. . If I ever find it necessary to edit one of the original Swiss Ephemeris distribution files, (has not happened yet as of Fri Apr 8 22:03:26 CDT 2011), then that file will be copyright Dieter Koch and Alois Treindl and Paul Elliott and it will be licensed under the GPL version 2 or later. . Thus every file in this distribution is copyrighted by somebody. And every file is licensed under the GPL version 2 or later. Files: debian/* Copyright: 2011,2012 Paul Elliott License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. Files: astrodienst/* Copyright: 1997-2008 Astrodienst AG 1997-2008 Dieter Koch 1997-2008 Alois Treindl Comment: These files were copied from ftp://ftp.astro.com/pub/swisseph/swe_unix_src_1.77.00.tar.gz Known as the Swiss Ephemeris. These are the main source files for the package. Astrodienst deserves the main credit for this package. All bugs related to the program source will be refered to astrodienst Only bug caused by autotools building or packaging will be handled by Paul Elliott License: GPL-2+ /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. . License conditions ------------------ . This file is part of Swiss Ephemeris. . Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author or distributor accepts any responsibility for the consequences of using it, or for whether it serves any particular purpose or works at all, unless he or she says so in writing. . Swiss Ephemeris is made available by its authors under a dual licensing system. The software developer, who uses any part of Swiss Ephemeris in his or her software, must choose between one of the two license models, which are a) GNU public license version 2 or later b) Swiss Ephemeris Professional License . The choice must be made before the software developer distributes software containing parts of Swiss Ephemeris to others, and before any public service using the developed software is activated. . If the developer choses the GNU GPL software license, he or she must fulfill the conditions of that license, which includes the obligation to place his or her whole software project under the GNU GPL or a compatible license. See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html . If the developer choses the Swiss Ephemeris Professional license, he must follow the instructions as found in http://www.astro.com/swisseph/ and purchase the Swiss Ephemeris Professional Edition from Astrodienst and sign the corresponding license contract. . The License grants you the right to use, copy, modify and redistribute Swiss Ephemeris, but only under certain conditions described in the License. Among other things, the License requires that the copyright notices and this notice be preserved on all copies. . Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl . The authors of Swiss Ephemeris have no control or influence over any of the derived works, i.e. over software or services created by other programmers which use Swiss Ephemeris functions. . The names of the authors or of the copyright holder (Astrodienst) must not be used for promoting any software, product or service which uses or contains the Swiss Ephemeris. This copyright notice is the ONLY place where the names of the authors can legally appear, except in cases where they have given special permission in writing. . The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used for promoting such software, products or services. */ Files: astrodocsrc/* Copyright: 1997-2008 Astrodienst AG 1997-2008 Dieter Koch 1997-2008 Alois Treindl License: GPL-2+ /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. . License conditions ------------------ . This file is part of Swiss Ephemeris. . Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author or distributor accepts any responsibility for the consequences of using it, or for whether it serves any particular purpose or works at all, unless he or she says so in writing. . Swiss Ephemeris is made available by its authors under a dual licensing system. The software developer, who uses any part of Swiss Ephemeris in his or her software, must choose between one of the two license models, which are a) GNU public license version 2 or later b) Swiss Ephemeris Professional License . The choice must be made before the software developer distributes software containing parts of Swiss Ephemeris to others, and before any public service using the developed software is activated. . If the developer choses the GNU GPL software license, he or she must fulfill the conditions of that license, which includes the obligation to place his or her whole software project under the GNU GPL or a compatible license. See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html . If the developer choses the Swiss Ephemeris Professional license, he must follow the instructions as found in http://www.astro.com/swisseph/ and purchase the Swiss Ephemeris Professional Edition from Astrodienst and sign the corresponding license contract. . The License grants you the right to use, copy, modify and redistribute Swiss Ephemeris, but only under certain conditions described in the License. Among other things, the License requires that the copyright notices and this notice be preserved on all copies. . Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl . The authors of Swiss Ephemeris have no control or influence over any of the derived works, i.e. over software or services created by other programmers which use Swiss Ephemeris functions. . The names of the authors or of the copyright holder (Astrodienst) must not be used for promoting any software, product or service which uses or contains the Swiss Ephemeris. This copyright notice is the ONLY place where the names of the authors can legally appear, except in cases where they have given special permission in writing. . The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used for promoting such software, products or services. */ debian/source/0000775000000000000000000000000012236254140010467 5ustar debian/source/format0000664000000000000000000000001412236254140011675 0ustar 3.0 (quilt) debian/README.Debian0000664000000000000000000000345412236254140011236 0ustar libswe for Debian ----------------- libswe source has been patched for use with debian and rpm based distros. The Default value of SE_EPHE_PATH has been changed from ".:/users/ephe2/:/users/ephe/" to ".:/usr/share/libswe/ephe2/:/usr/share/libswe/ephe/" The root directory /users does not exist on most packaged Linux distros. This will put the Swiss Ephemeris's data in directories that can be installed by packages. swe-basic-data is the data needed for all use of the Swiss Ephemeris. other packages will provide the other optional data. The Swiss Ephemeris can be used without any installed data at all, if the user supplies data in his own private directory. The Swiss Ephemeris was not created in the UNIX/Gnu Linux world and hence does not have an UNIX/Gnu Linux style manpage. The manpages merely refer to documentation available elsewhere. It is however well documented in the following files in the package libswe-dev: /usr/share/doc/libswe-dev/swephprg.pdf /usr/share/doc/libswe-dev/swisseph.pdf /usr/share/doc/libswe-dev/swephprg.html /usr/share/doc/libswe-dev/swisseph.html This documentation can also be found on line on astrodienst's web pages. Astrodienst has asked me to remove the public interface to pcalc, i.e. swepcalc.h. http://tech.groups.yahoo.com/group/swisseph/message/3129 This will make this version of astrodienst upwards compatible with the next release from astrodienst which will not included it. I believe no freesoftware actualy uses this code. Remove #include "swepcalc.h" from your code if you have it. This version of the library will not work if you do this include. You will have to remove it anyway when v 78 comes out because astrodienst is making it go away. The current source version is 1.77.00.0001 -- Paul Elliott Mon, 01 Aug 2011 23:38:57 -0500 debian/TODO0000664000000000000000000000015412236254140007657 0ustar As soon as this bug is fixed: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=531321 create a debian/watch debian/libswe-dev.manpages0000664000000000000000000000003512236254140012743 0ustar libswe.3 swetest.1 swemini.1 debian/libswe0.install0000664000000000000000000000002412236254140012120 0ustar usr/lib/*/lib*.so.* debian/libswe0.lintian-overrides0000664000000000000000000000025312236254140014114 0ustar #Can not correct spelling of upstream source. #mispelling comes from astrodienst. libswe0 binary: spelling-error-in-copyright GNU public license GNU General Public Licensedebian/swe-basic-data.lintian-overrides0000664000000000000000000000026212236254140015333 0ustar #Can not correct spelling of upstream source. #mispelling comes from astrodienst. swe-basic-data binary: spelling-error-in-copyright GNU public license GNU General Public Licensedebian/swe-basic-data.install0000664000000000000000000000002312236254140013336 0ustar usr/share/libswe/* debian/libswe0.dirs0000664000000000000000000000001012236254140011406 0ustar usr/lib debian/libswe-dev.install0000664000000000000000000000021012236254140012611 0ustar usr/include/* usr/lib/*/lib*.a usr/lib/*/lib*.so usr/lib/*/pkgconfig/* #new packages should omit the .la file #usr/lib/*/*.la usr/bin/* debian/libswe-dev.examples0000664000000000000000000000006412236254140012770 0ustar astrodienst/src/swetest.c astrodienst/src/swemini.c debian/libswe0.symbols0000664000000000000000000000525612236254140012156 0ustar libswe.so.0 libswe0 #MINVER# swe_azalt@Base 1.80.00.0001 swe_azalt_rev@Base 1.80.00.0001 swe_calc@Base 1.80.00.0001 swe_calc_ut@Base 1.80.00.0001 swe_close@Base 1.80.00.0001 swe_cotrans@Base 1.80.00.0001 swe_cotrans_sp@Base 1.80.00.0001 swe_cs2degstr@Base 1.80.00.0001 swe_cs2lonlatstr@Base 1.80.00.0001 swe_cs2timestr@Base 1.80.00.0001 swe_csnorm@Base 1.80.00.0001 swe_csroundsec@Base 1.80.00.0001 swe_d2l@Base 1.80.00.0001 swe_date_conversion@Base 1.80.00.0001 swe_day_of_week@Base 1.80.00.0001 swe_deg_midp@Base 1.80.00.0001 swe_degnorm@Base 1.80.00.0001 swe_deltat@Base 1.80.00.0001 swe_difcs2n@Base 1.80.00.0001 swe_difcsn@Base 1.80.00.0001 swe_difdeg2n@Base 1.80.00.0001 swe_difdegn@Base 1.80.00.0001 swe_difrad2n@Base 1.80.00.0001 swe_fixstar@Base 1.80.00.0001 swe_fixstar_mag@Base 1.80.00.0001 swe_fixstar_ut@Base 1.80.00.0001 swe_gauquelin_sector@Base 1.80.00.0001 swe_get_ayanamsa@Base 1.80.00.0001 swe_get_ayanamsa_name@Base 1.80.00.0001 swe_get_ayanamsa_ut@Base 1.80.00.0001 swe_get_planet_name@Base 1.80.00.0001 swe_get_tid_acc@Base 1.80.00.0001 swe_heliacal_angle@Base 1.80.00.0001 swe_heliacal_pheno_ut@Base 1.80.00.0001 swe_heliacal_ut@Base 1.80.00.0001 swe_house_pos@Base 1.80.00.0001 swe_houses@Base 1.80.00.0001 swe_houses_armc@Base 1.80.00.0001 swe_houses_ex@Base 1.80.00.0001 swe_jdet_to_utc@Base 1.80.00.0001 swe_jdut1_to_utc@Base 1.80.00.0001 swe_julday@Base 1.80.00.0001 swe_lun_eclipse_how@Base 1.80.00.0001 swe_lun_eclipse_when@Base 1.80.00.0001 swe_lun_occult_when_glob@Base 1.80.00.0001 swe_lun_occult_when_loc@Base 1.80.00.0001 swe_lun_occult_where@Base 1.80.00.0001 swe_nod_aps@Base 1.80.00.0001 swe_nod_aps_ut@Base 1.80.00.0001 swe_pheno@Base 1.80.00.0001 swe_pheno_ut@Base 1.80.00.0001 swe_rad_midp@Base 1.80.00.0001 swe_radnorm@Base 1.80.00.0001 swe_refrac@Base 1.80.00.0001 swe_refrac_extended@Base 1.80.00.0001 swe_revjul@Base 1.80.00.0001 swe_rise_trans@Base 1.80.00.0001 swe_rise_trans_true_hor@Base 1.80.00.0001 swe_set_ephe_path@Base 1.80.00.0001 swe_set_jpl_file@Base 1.80.00.0001 swe_set_lapse_rate@Base 1.80.00.0001 swe_set_sid_mode@Base 1.80.00.0001 swe_set_tid_acc@Base 1.80.00.0001 swe_set_topo@Base 1.80.00.0001 swe_sidtime0@Base 1.80.00.0001 swe_sidtime@Base 1.80.00.0001 swe_sol_eclipse_how@Base 1.80.00.0001 swe_sol_eclipse_when_glob@Base 1.80.00.0001 swe_sol_eclipse_when_loc@Base 1.80.00.0001 swe_sol_eclipse_where@Base 1.80.00.0001 swe_split_deg@Base 1.80.00.0001 swe_time_equ@Base 1.80.00.0001 swe_topo_arcus_visionis@Base 1.80.00.0001 swe_utc_time_zone@Base 1.80.00.0001 swe_utc_to_jd@Base 1.80.00.0001 swe_version@Base 1.80.00.0001 swe_vis_limit_mag@Base 1.80.00.0001 swe_house_name@Base 1.80.00.0001 debian/control0000664000000000000000000000412712261620465010603 0ustar Source: libswe Priority: extra Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Paul Elliott Uploaders: Jaldhar H. Vyas Build-Depends: debhelper (>= 9~), dh-autoreconf Standards-Version: 3.9.4 Section: libs Homepage: http://swissephauto.blackpatchpanel.com/ Vcs-Git: git://anonscm.debian.org/collab-maint/libswe.git/ Vcs-browser: http://anonscm.debian.org/git/collab-maint/libswe.git/ Package: libswe-dev Section: libdevel Architecture: any Depends: libswe0 (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Description: C library for The Swiss Ephemeris Contains static library, headers, example code and development manpages for libswe0. The Swiss Ephemeris offers these advantages: The Swiss Ephemeris is based upon the latest planetary and lunar ephemeris, DE405/406, developed by NASA's Jet Propulsion Laboratory. Package: libswe0 Architecture: any Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} Multi-Arch: same Recommends: swe-basic-data (>=1.80.00), swe-standard-data Description: C library for the Swiss Ephemeris libswe0 allows programs to access the Swiss Ephemeris. The SWISS EPHEMERIS is the high precision ephemeris developed by Astrodienst, largely based upon the DE406 ephemeris from NASA's JPL. The Swiss Ephemeris is based upon the latest planetary and lunar ephemeris, DE405/406, developed by NASA's Jet Propulsion Laboratory. Package: swe-basic-data Section: science Architecture: all Depends: ${misc:Depends} Multi-Arch: foreign Description: basic data files for the libswe package This package includes basic data files needed by libswe, the Swiss Ephemeris. The basic data consists of these files: /usr/share/libswe/ephe/sedeltat.txt.inactive /usr/share/libswe/ephe/sefstars.txt /usr/share/libswe/ephe/seleapsec.txt /usr/share/libswe/ephe/seorbel.txt /usr/share/libswe/ephe/fixstars.cat The Swiss Ephemeris library can be used without installed data, if the user provides that data in her own private directory and points to it with SE_EPHE_PATH. debian/docs0000664000000000000000000000004512236254140010041 0ustar NEWS AUTHORS README debian/copyright debian/patches/0000775000000000000000000000000012236254140010616 5ustar debian/patches/series0000664000000000000000000000010012236254140012022 0ustar 0001-harden-library-swetest-against-buffer-overflow-attac.patch debian/patches/0001-harden-library-swetest-against-buffer-overflow-attac.patch0000664000000000000000000011015312236254140024443 0ustar From 8fa44ee18ad3934d63cac26fca4b2743f1d760d4 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Sun, 22 Sep 2013 02:30:15 -0500 Subject: harden library, swetest against buffer overflow attack on sprintf calls to sprintf with '%s' in format replaced with snprint calls. Forwarded: privately Author: Paul Elliott --- astrodienst/src/swecl.c | 2 +- astrodienst/src/swehel.c | 11 ++-- astrodienst/src/swejpl.c | 4 +- astrodienst/src/swemplan.c | 23 ++++---- astrodienst/src/sweph.c | 34 +++++------ astrodienst/src/swephlib.c | 16 +++--- astrodienst/src/swetest.c | 140 ++++++++++++++++++++++++--------------------- 7 files changed, 120 insertions(+), 110 deletions(-) diff --git a/astrodienst/src/swecl.c b/astrodienst/src/swecl.c index 5bd3766..7a92514 100644 --- a/astrodienst/src/swecl.c +++ b/astrodienst/src/swecl.c @@ -1588,7 +1588,7 @@ next_try: } else { swe_get_planet_name(ipl , s); } - sprintf(serr, "error in swe_lun_occult_when_glob(): conjunction of moon with planet %s not found\n", s); + snprintf(serr, AS_MAXCH, "error in swe_lun_occult_when_glob(): conjunction of moon with planet %s not found\n", s); } return ERR; } diff --git a/astrodienst/src/swehel.c b/astrodienst/src/swehel.c index 1080f20..98bcc49 100644 --- a/astrodienst/src/swehel.c +++ b/astrodienst/src/swehel.c @@ -2407,7 +2407,8 @@ static int32 get_asc_obl(double tjd, int32 ipl, char *star, int32 iflag, double strcpy(s, star); else swe_get_planet_name(ipl, s); - sprintf(serr, "%s is circumpolar, cannot calculate heliacal event", s); + snprintf(serr, AS_MAXCH, + "%s is circumpolar, cannot calculate heliacal event", s); return -2; } adp = asin(adp) / DEGTORAD; @@ -2439,7 +2440,7 @@ static int32 get_asc_obl_old(double tjd, int32 ipl, char *star, int32 iflag, dou strcpy(s, star); else swe_get_planet_name(ipl, s); - sprintf(serr, "%s is circumpolar, cannot calculate heliacal event", s); + snprintf(serr, AS_MAXCH, "%s is circumpolar, cannot calculate heliacal event", s); return -2; } adp = asin(adp) / DEGTORAD; @@ -3342,7 +3343,7 @@ int32 FAR PASCAL_CONV swe_heliacal_ut(double JDNDaysUTStart, double *dgeo, doubl if (Planet == SE_MOON) { if (TypeEvent == 1 || TypeEvent == 2) { if (serr_ret != NULL) { - sprintf(serr_ret, "%s (event type %d) does not exist for the moon\n", sevent[TypeEvent], TypeEvent); + snprintf(serr_ret, AS_MAXCH, "%s (event type %d) does not exist for the moon\n", sevent[TypeEvent], TypeEvent); } return ERR; } @@ -3368,7 +3369,7 @@ int32 FAR PASCAL_CONV swe_heliacal_ut(double JDNDaysUTStart, double *dgeo, doubl strcpy(s, ObjectName); else swe_get_planet_name(Planet, s); - sprintf(serr_ret, "%s (event type %d) does not exist for %s\n", sevent[TypeEvent], TypeEvent, s); + snprintf(serr_ret, AS_MAXCH, "%s (event type %d) does not exist for %s\n", sevent[TypeEvent], TypeEvent, s); } return ERR; } @@ -3391,7 +3392,7 @@ int32 FAR PASCAL_CONV swe_heliacal_ut(double JDNDaysUTStart, double *dgeo, doubl strcpy(s, ObjectName); else swe_get_planet_name(Planet, s); - sprintf(serr_ret, "%s (event type %d) is not provided for %s\n", sevent[TypeEvent], TypeEvent, s); + snprintf(serr_ret, AS_MAXCH, "%s (event type %d) is not provided for %s\n", sevent[TypeEvent], TypeEvent, s); } return ERR; } diff --git a/astrodienst/src/swejpl.c b/astrodienst/src/swejpl.c index fcc5786..b04aecb 100644 --- a/astrodienst/src/swejpl.c +++ b/astrodienst/src/swejpl.c @@ -209,7 +209,7 @@ static int32 fsizer(char *serr) if (serr != NULL) { strcpy(serr, "alleged ephemeris file has invalid format."); if (strlen(serr) + strlen(js->jplfname) + 3 < AS_MAXCH) { - sprintf(serr, "alleged ephemeris file (%s) has invalid format.", js->jplfname); + snprintf(serr, AS_MAXCH, "alleged ephemeris file (%s) has invalid format.", js->jplfname); } } return(NOT_AVAILABLE); @@ -740,7 +740,7 @@ static int state(double et, int32 *list, int do_bary, if (serr != NULL) { sprintf(serr, "JPL ephemeris file is mutilated; length = %d instead of %d.", flen, nb); if (strlen(serr) + strlen(js->jplfname) < AS_MAXCH - 1) { - sprintf(serr, "JPL ephemeris file %s is mutilated; length = %d instead of %d.", js->jplfname, flen, nb); + snprintf(serr, AS_MAXCH, "JPL ephemeris file %s is mutilated; length = %d instead of %d.", js->jplfname, flen, nb); } } return(NOT_AVAILABLE); diff --git a/astrodienst/src/swemplan.c b/astrodienst/src/swemplan.c index cfd07a8..f379fe4 100644 --- a/astrodienst/src/swemplan.c +++ b/astrodienst/src/swemplan.c @@ -754,10 +754,11 @@ static int read_elements_file(int32 ipl, double tjd, if ((sp = strchr(s, '#')) != NULL) *sp = '\0'; ncpos = swi_cutstr(s, ",", cpos, 20); - sprintf(serri, "error in file %s, line %7.0f:", SE_FICTFILE, (double) iline); + snprintf(serri, AS_MAXCH, "error in file %s, line %7.0f:", + SE_FICTFILE, (double) iline); if (ncpos < 9) { if (serr != NULL) { - sprintf(serr, "%s nine elements required", serri); + snprintf(serr, AS_MAXCH, "%s nine elements required", serri); } return ERR; } @@ -778,7 +779,7 @@ static int read_elements_file(int32 ipl, double tjd, *tjd0 = J1900; else if (*sp == 'j' || *sp == 'b') { if (serr != NULL) { - sprintf(serr, "%s invalid epoch", serri); + snprintf(serr, AS_MAXCH, "%s invalid epoch", serri); } goto return_err; } else @@ -802,7 +803,7 @@ static int read_elements_file(int32 ipl, double tjd, *tequ = tjd; else if (*sp == 'j' || *sp == 'b') { if (serr != NULL) { - sprintf(serr, "%s invalid equinox", serri); + snprintf(serr, AS_MAXCH, "%s invalid equinox", serri); } goto return_err; } else @@ -814,7 +815,7 @@ static int read_elements_file(int32 ipl, double tjd, *mano = swe_degnorm(*mano); if (retc == ERR) { if (serr != NULL) { - sprintf(serr, "%s mean anomaly value invalid", serri); + snprintf(serr, AS_MAXCH, "%s mean anomaly value invalid", serri); } goto return_err; } @@ -832,7 +833,7 @@ static int read_elements_file(int32 ipl, double tjd, retc = check_t_terms(tt, cpos[3], sema); if (*sema <= 0 || retc == ERR) { if (serr != NULL) { - sprintf(serr, "%s semi-axis value invalid", serri); + snprintf(serr, AS_MAXCH, "%s semi-axis value invalid", serri); } goto return_err; } @@ -842,7 +843,7 @@ static int read_elements_file(int32 ipl, double tjd, retc = check_t_terms(tt, cpos[4], ecce); if (*ecce >= 1 || *ecce < 0 || retc == ERR) { if (serr != NULL) { - sprintf(serr, "%s eccentricity invalid (no parabolic or hyperbolic orbits allowed)", serri); + snprintf(serr, AS_MAXCH, "%s eccentricity invalid (no parabolic or hyperbolic orbits allowed)", serri); } goto return_err; } @@ -853,7 +854,7 @@ static int read_elements_file(int32 ipl, double tjd, *parg = swe_degnorm(*parg); if (retc == ERR) { if (serr != NULL) { - sprintf(serr, "%s perihelion argument value invalid", serri); + snprintf(serr, AS_MAXCH, "%s perihelion argument value invalid", serri); } goto return_err; } @@ -865,7 +866,7 @@ static int read_elements_file(int32 ipl, double tjd, *node = swe_degnorm(*node); if (retc == ERR) { if (serr != NULL) { - sprintf(serr, "%s node value invalid", serri); + snprintf(serr, AS_MAXCH, "%s node value invalid", serri); } goto return_err; } @@ -877,7 +878,7 @@ static int read_elements_file(int32 ipl, double tjd, *incl = swe_degnorm(*incl); if (retc == ERR) { if (serr != NULL) { - sprintf(serr, "%s inclination value invalid", serri); + snprintf(serr, AS_MAXCH, "%s inclination value invalid", serri); } goto return_err; } @@ -902,7 +903,7 @@ static int read_elements_file(int32 ipl, double tjd, } if (!elem_found) { if (serr != NULL) { - sprintf(serr, "%s elements for planet %7.0f not found", serri, (double) ipl); + snprintf(serr, AS_MAXCH, "%s elements for planet %7.0f not found", serri, (double) ipl); } goto return_err; } diff --git a/astrodienst/src/sweph.c b/astrodienst/src/sweph.c index b8ff275..d7b7430 100644 --- a/astrodienst/src/sweph.c +++ b/astrodienst/src/sweph.c @@ -1844,7 +1844,7 @@ again: char *spp; spp = strchr(s, '.'); if (spp > s && *(spp-1) != 's') { /* no 's' before '.' ? */ - sprintf(spp, "s.%s", SE_FILE_SUFFIX); /* insert an 's' */ + snprintf(spp, AS_MAXCH, "s.%s", SE_FILE_SUFFIX); /* insert an 's' */ goto again; } /* @@ -2007,7 +2007,7 @@ FILE *swi_fopen(int ifno, char *fname, char *ephepath, char *serr) if (fp != NULL) return fp; } - sprintf(s, "SwissEph file '%s' not found in PATH '%s'", fname, ephepath); + snprintf(s, AS_MAXCH, "SwissEph file '%s' not found in PATH '%s'", fname, ephepath); s[AS_MAXCH-1] = '\0'; /* s must not be longer then AS_MAXCH */ if (serr != NULL) strcpy(serr, s); @@ -3565,7 +3565,7 @@ static int get_new_segment(double tjd, int ipli, int ifno, char *serr) if (serr != NULL) { sprintf(serr, "error in ephemeris file: %d coefficients instead of %d. ", nco, pdp->ncoe); if (strlen(serr) + strlen(fdp->fnam) < AS_MAXCH - 1) { - sprintf(serr, "error in ephemeris file %s: %d coefficients instead of %d. ", fdp->fnam, nco, pdp->ncoe); + snprintf(serr, AS_MAXCH, "error in ephemeris file %s: %d coefficients instead of %d. ", fdp->fnam, nco, pdp->ncoe); } } free(pdp->segp); @@ -3706,7 +3706,7 @@ static int read_const(int ifno, char *serr) *sp = tolower((int) *sp); if (strcmp(s2, s) != 0) { if (serr != NULL) { - sprintf(serr, "Ephemeris file name '%s' wrong; rename '%s' ", s2, s); + snprintf(serr, AS_MAXCH, "Ephemeris file name '%s' wrong; rename '%s' ", s2, s); } goto return_error; } @@ -3984,7 +3984,7 @@ file_damage: if (serr != NULL) { *serr = '\0'; if (strlen(serr_file_damage) + strlen(fdp->fnam) < AS_MAXCH) { - sprintf(serr, serr_file_damage, fdp->fnam); + snprintf(serr, AS_MAXCH, serr_file_damage, fdp->fnam); } } return_error: @@ -4022,7 +4022,7 @@ static int do_fread(void *trg, int size, int count, int corrsize, FILE *fp, int3 if (serr != NULL) { strcpy(serr, "Ephemeris file is damaged. "); if (strlen(serr) + strlen(swed.fidat[ifno].fnam) < AS_MAXCH - 1) { - sprintf(serr, "Ephemeris file %s is damaged.", swed.fidat[ifno].fnam); + snprintf(serr, AS_MAXCH, "Ephemeris file %s is damaged.", swed.fidat[ifno].fnam); } } fclose(fp); @@ -4035,7 +4035,7 @@ static int do_fread(void *trg, int size, int count, int corrsize, FILE *fp, int3 if (serr != NULL) { strcpy(serr, "Ephemeris file is damaged. "); if (strlen(serr) + strlen(swed.fidat[ifno].fnam) < AS_MAXCH - 1) { - sprintf(serr, "Ephemeris file %s is damaged.", swed.fidat[ifno].fnam); + snprintf(serr, AS_MAXCH, "Ephemeris file %s is damaged.", swed.fidat[ifno].fnam); } } fclose(fp); @@ -5313,7 +5313,7 @@ int32 FAR PASCAL_CONV swe_fixstar(char *star, double tjd, int32 iflag, continue; if ((sp = strchr(s, ',')) == NULL) { if (serr != NULL) { - sprintf(serr, "star file %s damaged at line %d", SE_STARFILE, fline); + snprintf(serr, AS_MAXCH, "star file %s damaged at line %d", SE_STARFILE, fline); } retc = ERR; goto return_err; @@ -5343,7 +5343,7 @@ int32 FAR PASCAL_CONV swe_fixstar(char *star, double tjd, int32 iflag, if (serr != NULL) { sprintf(serr, "star not found"); if (strlen(serr) + strlen(star) < AS_MAXCH) { - sprintf(serr, "star %s not found", star); + snprintf(serr, AS_MAXCH, "star %s not found", star); } } retc = ERR; @@ -5356,7 +5356,7 @@ int32 FAR PASCAL_CONV swe_fixstar(char *star, double tjd, int32 iflag, swi_right_trim(cpos[1]); if (i < 13) { if (serr != NULL) { - sprintf(serr, "data of star '%s,%s' incomplete", cpos[0], cpos[1]); + snprintf(serr, AS_MAXCH, "data of star '%s,%s' incomplete", cpos[0], cpos[1]); } retc = ERR; goto return_err; @@ -5378,9 +5378,7 @@ int32 FAR PASCAL_CONV swe_fixstar(char *star, double tjd, int32 iflag, cpos[0][SE_MAX_STNAME] = '\0'; if (strlen(cpos[1]) > SE_MAX_STNAME-1) cpos[1][SE_MAX_STNAME-1] = '\0'; - strcpy(star, cpos[0]); - if (strlen(cpos[0]) + strlen(cpos[1]) + 1 < SE_MAX_STNAME - 1) - sprintf(star + strlen(star), ",%s", cpos[1]); + snprintf(star, (SE_MAX_STNAME-1) , "%s,%s", cpos[0], cpos[1]); /**************************************** * position and speed (equinox) ****************************************/ @@ -5726,7 +5724,7 @@ int32 FAR PASCAL_CONV swe_fixstar_mag(char *star, double *mag, char *serr) continue; if ((sp = strchr(s, ',')) == NULL) { if (serr != NULL) { - sprintf(serr, "star file %s damaged at line %d", SE_STARFILE, fline); + snprintf(serr, AS_MAXCH, "star file %s damaged at line %d", SE_STARFILE, fline); } retc = ERR; goto return_err; @@ -5754,7 +5752,7 @@ int32 FAR PASCAL_CONV swe_fixstar_mag(char *star, double *mag, char *serr) if (serr != NULL) { strcpy(serr, "star not found"); if (strlen(serr) + strlen(star) < AS_MAXCH) { - sprintf(serr, "star %s not found", star); + snprintf(serr,AS_MAXCH, "star %s not found", star); } } retc = ERR; @@ -5767,7 +5765,7 @@ int32 FAR PASCAL_CONV swe_fixstar_mag(char *star, double *mag, char *serr) if (serr != NULL) { strcpy(serr, "data of star incomplete"); if (strlen(serr) + strlen(cpos[0]) + strlen(cpos[1]) + 2 < AS_MAXCH) { - sprintf(serr, "data of star '%s,%s' incomplete", cpos[0], cpos[1]); + snprintf(serr,AS_MAXCH, "data of star '%s,%s' incomplete", cpos[0], cpos[1]); } } retc = ERR; @@ -5779,9 +5777,7 @@ int32 FAR PASCAL_CONV swe_fixstar_mag(char *star, double *mag, char *serr) cpos[0][SE_MAX_STNAME] = '\0'; if (strlen(cpos[1]) > SE_MAX_STNAME-1) cpos[1][SE_MAX_STNAME-1] = '\0'; - strcpy(star, cpos[0]); - if (strlen(cpos[0]) + strlen(cpos[1]) + 1 < SE_MAX_STNAME - 1) - sprintf(star + strlen(star), ",%s", cpos[1]); + snprintf(star, (SE_MAX_STNAME) , "%s,%s", cpos[0], cpos[1]); return OK; return_err: *mag = 0; diff --git a/astrodienst/src/swephlib.c b/astrodienst/src/swephlib.c index 3a67dee..6364d42 100644 --- a/astrodienst/src/swephlib.c +++ b/astrodienst/src/swephlib.c @@ -2325,7 +2325,9 @@ void swi_gen_filename(double tjd, int ipli, char *fname) sform = "ast%d%sse%05d.%s"; if (ipli - SE_AST_OFFSET > 99999) sform = "ast%d%ss%06d.%s"; - sprintf(fname, sform, (ipli - SE_AST_OFFSET) / 1000, DIR_GLUE, ipli - SE_AST_OFFSET, SE_FILE_SUFFIX); + snprintf(fname, AS_MAXCH, sform, + (ipli - SE_AST_OFFSET) / 1000, DIR_GLUE, ipli - SE_AST_OFFSET, + SE_FILE_SUFFIX); return; /* asteroids: only one file 3000 bc - 3000 ad */ /* break; */ } @@ -2361,7 +2363,7 @@ void swi_gen_filename(double tjd, int ipli, char *fname) else strcat(fname, "_"); icty = abs(icty); - sprintf(fname + strlen(fname), "%02d.%s", icty, SE_FILE_SUFFIX); + snprintf(fname + strlen(fname),AS_MAXCH - strlen(fname), "%02d.%s", icty, SE_FILE_SUFFIX); #if 0 printf("fname %s\n", fname); fflush(stdout); @@ -2601,7 +2603,7 @@ char *FAR PASCAL_CONV swe_cs2degstr(CSEC t, char *a) s = t % 60L; m = t / 60 % 60L; h = t / 3600 % 100L; /* only 0..99 degrees */ - sprintf(a, "%2d%s%02d'%02d", h, ODEGREE_STRING, m, s); + snprintf(a, 9, "%2d%s%02d'%02d", h, ODEGREE_STRING, m, s); return (a); } /* swe_cs2degstr() */ @@ -2771,11 +2773,11 @@ void swi_open_trace(char *serr) # else ipid = getpid(); # endif - sprintf(sp1, "_%d%s", ipid, sp); + snprintf(sp1, AS_MAXCH, "_%d%s", ipid, sp); #endif if ((swi_fp_trace_c = fopen(fname, FILE_A_ACCESS)) == NULL) { if (serr != NULL) { - sprintf(serr, "could not open trace output file '%s'", fname); + snprintf(serr, AS_MAXCH, "could not open trace output file '%s'", fname); } } else { fputs("#include \"sweodef.h\"\n", swi_fp_trace_c); @@ -2804,11 +2806,11 @@ void swi_open_trace(char *serr) # else ipid = getpid(); # endif - sprintf(sp1, "_%d%s", ipid, sp); + snprintf(sp1, AS_MAXCH, "_%d%s", ipid, sp); #endif if ((swi_fp_trace_out = fopen(fname, FILE_A_ACCESS)) == NULL) { if (serr != NULL) { - sprintf(serr, "could not open trace output file '%s'", fname); + snprintf(serr, AS_MAXCH, "could not open trace output file '%s'", fname); } } } diff --git a/astrodienst/src/swetest.c b/astrodienst/src/swetest.c index c017b02..5254c6a 100644 --- a/astrodienst/src/swetest.c +++ b/astrodienst/src/swetest.c @@ -907,10 +907,7 @@ int main(int argc, char *argv[]) fputs(infoexamp,stdout); goto end_main; } else { - strcpy(sout, "illegal option "); - strncat(sout, argv[i], sizeof(sout) - 50); - strcat(sout, "\n"); - fputs(sout,stdout); + printf("illegal option %s\n", argv[i]); exit(1); } } @@ -1002,7 +999,7 @@ int main(int argc, char *argv[]) strcpy (sdate_save, sdate); } if (*sdate == '\0') { - sprintf(sdate, "j%f", tjd); + snprintf(sdate,sizeof(sdate), "j%f", tjd); } if (*sp == 'j') { /* it's a day number */ if ((sp2 = strchr(sp, ',')) != NULL) @@ -1865,18 +1862,18 @@ static char *dms(double xv, int32 iflg) izod = (int) (xv / 30); xv = fmod(xv, 30); kdeg = (int32) xv; - sprintf(s, "%2d %s ", kdeg, zod_nam[izod]); + snprintf(s,sizeof(s), "%2d %s ", kdeg, zod_nam[izod]); } else { kdeg = (int32) xv; - sprintf(s, " %3d%s", kdeg, c); + snprintf(s,sizeof(s), " %3d%s", kdeg, c); } xv -= kdeg; xv *= 60; kmin = (int32) xv; if ((iflg & BIT_ZODIAC) && (iflg & BIT_ROUND_MIN)) { - sprintf(s1, "%2d", kmin); + snprintf(s1,sizeof(s1), "%2d", kmin); } else { - sprintf(s1, "%2d'", kmin); + snprintf(s1,sizeof(s1), "%2d'", kmin); } strcat(s, s1); if (iflg & BIT_ROUND_MIN) @@ -1885,16 +1882,16 @@ static char *dms(double xv, int32 iflg) xv *= 60; ksec = (int32) xv; if (iflg & BIT_ROUND_SEC) { - sprintf(s1, "%2d\"", ksec); + snprintf(s1,sizeof(s1), "%2d\"", ksec); } else { - sprintf(s1, "%2d", ksec); + snprintf(s1,sizeof(s1), "%2d", ksec); } strcat(s, s1); if (iflg & BIT_ROUND_SEC) goto return_dms; xv -= ksec; k = (int32) (xv * 10000); - sprintf(s1, ".%04d", k); + snprintf(s1,sizeof(s1), ".%04d", k); strcat(s, s1); return_dms:; if (sgn < 0) { @@ -1971,14 +1968,16 @@ static int32 call_rise_set(double t_ut, int32 ipl, char *star, int32 whicheph, i strcat(sout, " - "); } else { swe_revjul(tret[0], gregflag, &jyear, &jmon, &jday, &jut); - sprintf(sout + strlen(sout), "%2d.%02d.%04d\t%s ", jday, jmon, jyear, hms(jut,BIT_LZEROES)); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%2d.%02d.%04d\t%s ", + jday, jmon, jyear, hms(jut,BIT_LZEROES)); } strcat(sout, "set "); if (tret[1] == 0) { strcat(sout, " - \n"); } else { swe_revjul(tret[1], gregflag, &jyear, &jmon, &jday, &jut); - sprintf(sout + strlen(sout), "%2d.%02d.%04d\t%s\n", jday, jmon, jyear, hms(jut,BIT_LZEROES)); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%2d.%02d.%04d\t%s\n", + jday, jmon, jyear, hms(jut,BIT_LZEROES)); } do_printf(sout); } @@ -2000,13 +1999,15 @@ static int32 call_rise_set(double t_ut, int32 ipl, char *star, int32 whicheph, i if (tret[0] == 0) strcat(sout, " - "); else { swe_revjul(tret[0], gregflag, &jyear, &jmon, &jday, &jut); - sprintf(sout + strlen(sout), "%2d.%02d.%04d\t%s ", jday, jmon, jyear, hms(jut,BIT_LZEROES)); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%2d.%02d.%04d\t%s ", + jday, jmon, jyear, hms(jut,BIT_LZEROES)); } strcat(sout, "itransit "); if (tret[1] == 0) strcat(sout, " - \n"); else { swe_revjul(tret[1], gregflag, &jyear, &jmon, &jday, &jut); - sprintf(sout + strlen(sout), "%2d.%02d.%04d\t%s\n", jday, jmon, jyear, hms(jut,BIT_LZEROES)); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%2d.%02d.%04d\t%s\n", + jday, jmon, jyear, hms(jut,BIT_LZEROES)); } do_printf(sout); } @@ -2048,7 +2049,7 @@ ERR) { } strcpy(sout, sfmt); if (strchr(sfmt, '%') != NULL) { - sprintf(sout, sfmt, attr[0]); + snprintf(sout,sizeof(sout), sfmt, attr[0]); } do_printf(sout); } @@ -2082,34 +2083,35 @@ ERR) { return ERR; } dt = (tret[3] - tret[2]) * 24 * 60; - sprintf(s1, "%d min %4.2f sec", (int) dt, fmod(dt, 1) * 60); + snprintf(s1,sizeof(s1), "%d min %4.2f sec", + (int) dt, fmod(dt, 1) * 60); /* short output: * date, time of day, umbral magnitude, umbral duration, saros series, member number */ - sprintf(sout_short, "%s\t%2d.%2d.%4d\t%s\t%.3f\t%s\t%d\t%d\n", sout, jday, jmon, jyear, hms(jut,0), attr[8],s1, (int) attr[9], (int) attr[10]); - sprintf(sout + strlen(sout), "%2d.%02d.%04d\t%s\t%.4f/%.4f\tsaros %d/%d\t%.6f\n", jday, jmon, jyear, hms(jut,BIT_LZEROES), attr[0],attr[1], (int) attr[9], (int) attr[10], t_ut); + snprintf(sout_short,sizeof(sout_short) ,"%s\t%2d.%2d.%4d\t%s\t%.3f\t%s\t%d\t%d\n", sout, jday, jmon, jyear, hms(jut,0), attr[8],s1, (int) attr[9], (int) attr[10]); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%2d.%02d.%04d\t%s\t%.4f/%.4f\tsaros %d/%d\t%.6f\n", jday, jmon, jyear, hms(jut,BIT_LZEROES), attr[0],attr[1], (int) attr[9], (int) attr[10], t_ut); /* second line: * eclipse times, penumbral, partial, total begin and end */ - sprintf(sout + strlen(sout), " %s ", hms_from_tjd(tret[6])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), " %s ", hms_from_tjd(tret[6])); if (tret[2] != 0) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[2])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[2])); else strcat(sout, " - "); if (tret[4] != 0) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[4])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[4])); else strcat(sout, " - "); if (tret[5] != 0) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[5])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[5])); else strcat(sout, " - "); if (tret[3] != 0) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[3])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[3])); else strcat(sout, " - "); - sprintf(sout + strlen(sout), "%s\n", hms_from_tjd(tret[7])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s\n", hms_from_tjd(tret[7])); if (special_mode & SP_MODE_HOCAL) { swe_split_deg(jut, SE_SPLIT_DEG_ROUND_MIN, &ihou, &imin, &isec, &dfrc, &isgn); - sprintf(sout, "\"%04d %02d %02d %02d.%02d %d\",\n", jyear, jmon, jday, ihou, imin, ecl_type); + snprintf(sout,sizeof(sout), "\"%04d %02d %02d %02d.%02d %d\",\n", jyear, jmon, jday, ihou, imin, ecl_type); } if (short_output) do_printf(sout_short); @@ -2166,26 +2168,26 @@ attr, direction_flag, serr)) == ERR) { swe_calc(t_ut + swe_deltat(t_ut), SE_ECL_NUT, 0, x, serr); swe_revjul(t_ut, gregflag, &jyear, &jmon, &jday, &jut); dt = (tret[3] - tret[2]) * 24 * 60; - sprintf(sout + strlen(sout), "%2d.%02d.%04d\t%s\t%.4f/%.4f/%.4f\tsaros %d/%d\t%.6f\n", jday, jmon, jyear, hms(jut,BIT_LZEROES), attr[8], attr[0], attr[2], (int) attr[9], (int) attr[10], t_ut); - sprintf(sout + strlen(sout), "\t%d min %4.2f sec\t", (int) dt, fmod(dt, 1) * 60); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%2d.%02d.%04d\t%s\t%.4f/%.4f/%.4f\tsaros %d/%d\t%.6f\n", jday, jmon, jyear, hms(jut,BIT_LZEROES), attr[8], attr[0], attr[2], (int) attr[9], (int) attr[10], t_ut); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "\t%d min %4.2f sec\t", (int) dt, fmod(dt, 1) * 60); if (eclflag & SE_ECL_1ST_VISIBLE) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[1])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[1])); else strcat(sout, " - "); if (eclflag & SE_ECL_2ND_VISIBLE) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[2])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[2])); else strcat(sout, " - "); if (eclflag & SE_ECL_3RD_VISIBLE) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[3])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[3])); else strcat(sout, " - "); if (eclflag & SE_ECL_4TH_VISIBLE) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[4])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[4])); else strcat(sout, " - "); #if 0 - sprintf(sout + strlen(sout), "\t%d min %4.2f sec %s %s %s %s", + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "\t%d min %4.2f sec %s %s %s %s", (int) dt, fmod(dt, 1) * 60, strcpy(s1, hms(fmod(tret[1] + 0.5, 1) * 24, BIT_LZEROES)), strcpy(s3, hms(fmod(tret[2] + 0.5, 1) * 24, BIT_LZEROES)), @@ -2226,21 +2228,23 @@ attr, direction_flag, serr)) == ERR) { strcat(sout, "non-central "); swe_sol_eclipse_where(t_ut, whicheph, geopos, attr, serr); swe_revjul(t_ut, gregflag, &jyear, &jmon, &jday, &jut); - sprintf(sout_short, "%s\t%2d.%2d.%4d\t%s\t%.3f", sout, jday, jmon, jyear, hms(jut,0), attr[8]); - sprintf(sout + strlen(sout), "%2d.%02d.%04d\t%s\t%f km\t%.4f/%.4f/%.4f\tsaros %d/%d\t%.6f\n", jday, jmon, jyear, hms(jut,0), attr[3], attr[8], attr[0], attr[2], (int) attr[9], (int) attr[10], t_ut); - sprintf(sout + strlen(sout), "\t%s ", hms_from_tjd(tret[2])); + snprintf(sout_short,sizeof(sout_short), "%s\t%2d.%2d.%4d\t%s\t%.3f", + sout, jday, jmon, jyear, hms(jut,0), attr[8]); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%2d.%02d.%04d\t%s\t%f km\t%.4f/%.4f/%.4f\tsaros %d/%d\t%.6f\n", + jday, jmon, jyear, hms(jut,0), attr[3], attr[8], attr[0], attr[2], (int) attr[9], (int) attr[10], t_ut); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "\t%s ", hms_from_tjd(tret[2])); if (tret[4] != 0) { - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[4])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[4])); } else { strcat(sout, " - "); } if (tret[5] != 0) { - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[5])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[5])); } else { strcat(sout, " - "); } - sprintf(sout + strlen(sout), "%s\n", hms_from_tjd(tret[3])); - sprintf(sout + strlen(sout), "\t%s\t%s", strcpy(s1, dms(geopos[0], BIT_ROUND_MIN)), strcpy(s2, dms(geopos[1], BIT_ROUND_MIN))); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s\n", hms_from_tjd(tret[3])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "\t%s\t%s", strcpy(s1, dms(geopos[0], BIT_ROUND_MIN)), strcpy(s2, dms(geopos[1], BIT_ROUND_MIN))); strcat(sout, "\t"); strcat(sout_short, "\t"); if (!(eclflag & SE_ECL_PARTIAL) && !(eclflag & SE_ECL_NONCENTRAL)) { @@ -2252,18 +2256,19 @@ geopos, tret, attr, 0, serr)) == ERR) { if (fabs(tret[0] - t_ut) > 1) do_printf("when_loc returns wrong date\n"); dt = (tret[3] - tret[2]) * 24 * 60; - sprintf(s1, "%d min %4.2f sec", (int) dt, fmod(dt, 1) * 60); + snprintf(s1,sizeof(s1), "%d min %4.2f sec", + (int) dt, fmod(dt, 1) * 60); strcat(sout, s1); strcat(sout_short, s1); } - sprintf(sout_short + strlen(sout_short), "\t%d\t%d", (int) attr[9], (int) attr[10]); + snprintf(sout_short + strlen(sout_short),sizeof(sout_short) - strlen(sout_short), "\t%d\t%d", (int) attr[9], (int) attr[10]); strcat(sout, "\n"); strcat(sout_short, "\n"); if (special_mode & SP_MODE_HOCAL) { int ihou, imin, isec, isgn; double dfrc; swe_split_deg(jut, SE_SPLIT_DEG_ROUND_MIN, &ihou, &imin, &isec, &dfrc, &isgn); - sprintf(sout, "\"%04d %02d %02d %02d.%02d %d\",\n", jyear, jmon, jday, ihou, imin, ecl_type); + snprintf(sout,sizeof(sout), "\"%04d %02d %02d %02d.%02d %d\",\n", jyear, jmon, jday, ihou, imin, ecl_type); } /*printf("len=%ld\n", strlen(sout));*/ if (short_output) @@ -2318,26 +2323,26 @@ static int32 call_lunar_occultation(double t_ut, int32 ipl, char *star, int32 wh swe_calc(t_ut + swe_deltat(t_ut), SE_ECL_NUT, 0, x, serr); swe_revjul(t_ut, gregflag, &jyear, &jmon, &jday, &jut); dt = (tret[3] - tret[2]) * 24 * 60; - sprintf(sout + strlen(sout), "%2d.%02d.%04d\t%s\t%fo/o\n", jday, jmon, jyear, hms(jut,BIT_LZEROES), attr[0]); - sprintf(sout + strlen(sout), "\t%d min %4.2f sec\t", (int) dt, fmod(dt, 1) * 60); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%2d.%02d.%04d\t%s\t%fo/o\n", jday, jmon, jyear, hms(jut,BIT_LZEROES), attr[0]); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "\t%d min %4.2f sec\t", (int) dt, fmod(dt, 1) * 60); if (eclflag & SE_ECL_1ST_VISIBLE) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[1])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[1])); else strcat(sout, " - "); if (eclflag & SE_ECL_2ND_VISIBLE) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[2])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[2])); else strcat(sout, " - "); if (eclflag & SE_ECL_3RD_VISIBLE) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[3])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[3])); else strcat(sout, " - "); if (eclflag & SE_ECL_4TH_VISIBLE) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[4])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[4])); else strcat(sout, " - "); #if 0 - sprintf(sout + strlen(sout), "\t%d min %4.2f sec %s %s %s %s", + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "\t%d min %4.2f sec %s %s %s %s", (int) dt, fmod(dt, 1) * 60, strcpy(s1, hms(fmod(tret[1] + 0.5, 1) * 24, BIT_LZEROES)), strcpy(s3, hms(fmod(tret[2] + 0.5, 1) * 24, BIT_LZEROES)), @@ -2376,18 +2381,21 @@ static int32 call_lunar_occultation(double t_ut, int32 ipl, char *star, int32 wh strcat(sout, "non-central "); swe_lun_occult_where(t_ut, ipl, star, whicheph, geopos, attr, serr); swe_revjul(t_ut, gregflag, &jyear, &jmon, &jday, &jut); - sprintf(sout + strlen(sout), "%2d.%02d.%04d\t%s\t%f km\t%f o/o\n", jday, jmon, jyear, hms(jut,BIT_LZEROES), attr[3], attr[0]); - sprintf(sout + strlen(sout), "\t%s ", hms_from_tjd(tret[2])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%2d.%02d.%04d\t%s\t%f km\t%f o/o\n", + jday, jmon, jyear, hms(jut,BIT_LZEROES), attr[3], attr[0]); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "\t%s ", hms_from_tjd(tret[2])); if (tret[4] != 0) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[4])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[4])); else strcat(sout, " - "); if (tret[5] != 0) - sprintf(sout + strlen(sout), "%s ", hms_from_tjd(tret[5])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s ", hms_from_tjd(tret[5])); else strcat(sout, " - "); - sprintf(sout + strlen(sout), "%s\n", hms_from_tjd(tret[3])); - sprintf(sout + strlen(sout), "\t%s\t%s", strcpy(s1, dms(geopos[0], BIT_ROUND_MIN)), strcpy(s2, dms(geopos[1], BIT_ROUND_MIN))); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s\n", hms_from_tjd(tret[3])); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "\t%s\t%s", + strcpy(s1, dms(geopos[0], BIT_ROUND_MIN)), + strcpy(s2, dms(geopos[1], BIT_ROUND_MIN))); if (!(eclflag & SE_ECL_PARTIAL) && !(eclflag & SE_ECL_NONCENTRAL)) { if ((eclflag = swe_lun_occult_when_loc(t_ut - 10, ipl, star, whicheph, geopos, tret, attr, 0, serr)) == ERR) { do_printf(serr); @@ -2396,14 +2404,15 @@ static int32 call_lunar_occultation(double t_ut, int32 ipl, char *star, int32 wh if (fabs(tret[0] - t_ut) > 1) do_printf("when_loc returns wrong date\n"); dt = (tret[3] - tret[2]) * 24 * 60; - sprintf(sout + strlen(sout), "\t%d min %4.2f sec\t", (int) dt, fmod(dt, 1) * 60); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "\t%d min %4.2f sec\t", + (int) dt, fmod(dt, 1) * 60); } strcat(sout, "\n"); if (special_mode & SP_MODE_HOCAL) { int ihou, imin, isec, isgn; double dfrc; swe_split_deg(jut, SE_SPLIT_DEG_ROUND_MIN, &ihou, &imin, &isec, &dfrc, &isgn); - sprintf(sout, "\"%04d %02d %02d %02d.%02d %d\",\n", jyear, jmon, jday, ihou, imin, ecl_type); + snprintf(sout,sizeof(sout), "\"%04d %02d %02d %02d.%02d %d\",\n", jyear, jmon, jday, ihou, imin, ecl_type); } do_printf(sout); } @@ -2418,9 +2427,9 @@ static void do_print_heliacal(double *dret, int32 event_type, char *obj_name) *sout = '\0'; swe_revjul(dret[0], gregflag, &jyear, &jmon, &jday, &jut); if (event_type <= 4) { - sprintf(sout + strlen(sout), "%s %s: %d/%02d/%02d %sUT (%f), visible for: %#4.1f min\n", obj_name, sevtname[event_type], jyear, jmon, jday, hms_from_tjd(dret[0]), dret[0], (dret[2] - dret[0]) * 1440); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s %s: %d/%02d/%02d %sUT (%f), visible for: %#4.1f min\n", obj_name, sevtname[event_type], jyear, jmon, jday, hms_from_tjd(dret[0]), dret[0], (dret[2] - dret[0]) * 1440); } else { - sprintf(sout + strlen(sout), "%s %s: %d/%02d/%02d %sUT (%f)\n", obj_name, sevtname[event_type], jyear, jmon, jday, hms_from_tjd(dret[0]), dret[0]); + snprintf(sout + strlen(sout),sizeof(sout) - strlen(sout), "%s %s: %d/%02d/%02d %sUT (%f)\n", obj_name, sevtname[event_type], jyear, jmon, jday, hms_from_tjd(dret[0]), dret[0]); } do_printf(sout); } @@ -2548,7 +2557,7 @@ static int do_special_event(double tjd, int32 ipl, char *star, int32 special_eve static char *hms_from_tjd(double x) { static char s[AS_MAXCH]; - sprintf(s, "%s ", hms(fmod(x + 1000000.5, 1) * 24, BIT_LZEROES)); + snprintf(s,sizeof(s), "%s ", hms(fmod(x + 1000000.5, 1) * 24, BIT_LZEROES)); return s; } @@ -2596,14 +2605,15 @@ static int make_ephemeris_path(int32 iflg, char *argv0) if (iflg & SEFLG_MOSEPH) return OK; /* current working directory */ - sprintf(path, ".%c", *PATH_SEPARATOR); + snprintf(path,sizeof(path), ".%c", *PATH_SEPARATOR); /* program directory */ sp = strrchr(argv0, *dirglue); if (sp != NULL) { pathlen = sp - argv0; if (strlen(path) + pathlen < AS_MAXCH-2) { strncat(path, argv0, pathlen); - sprintf(path + strlen(path), "%c", *PATH_SEPARATOR); + snprintf(path + strlen(path),sizeof(path) - strlen(path), "%c", *PATH_SEPARATOR); + } } #if MSDOS @@ -2644,7 +2654,7 @@ static int make_ephemeris_path(int32 iflg, char *argv0) continue; for (j = 0; j < 3; j++) { if (sp[j] != NULL && strlen(path) + 2 + strlen(s) < AS_MAXCH-1) { - sprintf(path + strlen(path), "%c:%s%c", *sp[j], s, *PATH_SEPARATOR); + snprintf(path + strlen(path),sizeof(path) - strlen(path), "%c:%s%c", *sp[j], s, *PATH_SEPARATOR); } } } debian/libswe-dev.lintian-overrides0000664000000000000000000000025612236254140014613 0ustar #Can not correct spelling of upstream source. #mispelling comes from astrodienst. libswe-dev binary: spelling-error-in-copyright GNU public license GNU General Public License