debian/0000755000000000000000000000000011714476466007206 5ustar debian/xsoldier.xpm0000644000000000000000000000271311621752540011553 0ustar /* XPM */ static char *xsoldier[] = { /* columns rows colors chars-per-pixel */ "32 32 16 1", " c black", ". c #191919", "X c gray20", "o c #00007f", "O c #007f7f", "+ c #7f0000", "@ c #7f007f", "# c #4c4c4c", "$ c #666667", "% c gray50", "& c blue", "* c cyan", "= c red", "- c gray60", "; c #b2b2b2", ": c None", /* pixels */ "$.: : :::::::::::::::::: : :O$", "$Oo: : :::::::::::::::: : :O-$", "%oOO:. : :::::::::::::: : :OO&$", "%oO&X: : :::::::::::: : :O&&%$", "$o&OOO: : :::::::::: : :O&OOO%", "$OOO&Oo:. : : : : :oOO*&&$", "XoO&OOOo: :: :: :: :oO&*O&O$", ". oOo&OOo: :....: :O*&OO&O.X", " XO&OOOo: :X-$$X : :OOO&O&O.:.", " :.oOO&O&O::#;#$X.::O&&&O&OO: ", " : :.oOOO&Oo:#=+=+ :XO&OO*O.: ", ": : :.o&OOoOO===+++o*&O*O&o: : ", ":: : :.O&OOoO==+==+O&O&&Oo: : :", "::: : :.oOO&&==++++&O*OOo: : ::", ":::: : :oOOOO===+=#OO&Oo:. : :::", ":::: : :X&OO=@@@@+OO&O : ::::", "::::: : :oO#@&**&$OOO. : :::::", "::::: : :oOOO@***O@O&Oo: : :::::", ":::: : :.OO&o=@$$@@OOoO.: : ::::", "::: : :O&O&O==+=++oO&O& : : :::", ":: : :OOO&*&$==+=oOoOoOO. : ::", " : :O&&O&OOX=+++.OO&OOOo: : ", ":: :O&O*OOO.:+==+:.OO&&oOO: ::", " :..O&OO&&o.: ++. :.oOOO&Oo. : ", " :X$O&O*Oo: : .. : : oOO&OO%.: ", " :.$&O&o.: :: :: :.OO&O%.: ", " :.#&OO.: : :: :: : .:oOoO$.: ", " :.$OO : :::::::: : : O&O.: ", " :.#o: : ::::::::::: : :.o%.: ", " : X: : ::::::::::::: : #.: ", " :: : :::::::::::::::: : :..: ", ":: :::::::::::::::::::: : : " }; debian/copyright0000644000000000000000000000070311621752540011124 0ustar Copyright (C) 1997 Yuusuke HASHIMOTO Copyright (C) 2002 Oohara Yuuma xsoldier was packaged by Adrian Bridgett and was obtained from http://www.educ.info.kanagawa-u.ac.jp/~s945750. Now the upstream webpage is http://www.interq.or.jp/libra/oohara/xsoldier/index.html It is distributed under the GPL license, version 2 or later (/usr/share/common-licenses/GPL-2). debian/xsoldier.menu0000644000000000000000000000026511621752540011713 0ustar ?package(xsoldier):command="/usr/games/xsoldier" needs="X11" \ section="Games/Action" title="XSoldier" \ icon="/usr/share/games/xsoldier/xsoldier.xpm" debian/watch0000644000000000000000000000012111621752540010214 0ustar version=3 http://www.interq.or.jp/libra/oohara/xsoldier/xsoldier-(.+)\.tar\.gz debian/postinst0000644000000000000000000000303011623660457011002 0ustar #!/bin/sh # postinst script for xsoldier # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-deconfigure' `in-favour' # `removing' # # for details, see /usr/share/doc/packaging-manual/ # # quoting from the policy: # Any necessary prompting should almost always be confined to the # post-installation script, and should be protected with a conditional # so that unnecessary prompting doesn't happen if a package's # installation fails and the `postinst' is called with `abort-upgrade', # `abort-remove' or `abort-deconfigure'. case "$1" in configure) # install the default score file if test '!' -d /var/games/xsoldier/ then install -d -o root -g root -m 755 /var/games/xsoldier/ fi if test '!' -e /var/games/xsoldier/xsoldier.scores then install -o root -g games -m 664 \ /usr/share/games/xsoldier/xsoldier.scores /var/games/xsoldier/ fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 debian/control0000644000000000000000000000230411714464647010606 0ustar Source: xsoldier Section: games Priority: optional Maintainer: Oohara Yuuma Build-Depends: debhelper (>= 8), libsdl1.2-dev, libsdl-image1.2-dev, libx11-dev, libxpm-dev, x11proto-core-dev, dh-autoreconf, dpkg-dev (>= 1.16.1) Build-Conflicts: autoconf2.13, automake1.4 Standards-Version: 3.9.2 Homepage: http://www.interq.or.jp/libra/oohara/xsoldier/index.html Package: xsoldier Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: shoot 'em up game with the "not shooting" bonus You control a space ship in a vertically scrolling window and shoot enemies. If you kill the boss enemy which appears at the end of each stage, or if you can survive till the boss enemy gets bored with you and escapes, you can go to the next stage. . xsoldier has a unique feature --- the "not shooting" bonus. You can get a pretty good score by not pressing the shoot button. After all, if the game is a simple kill-everything and shooting is always a good thing, why do you have to press a shoot button? You can play xsoldier as a simple kill-everything (and it is the best way to survive), but if you care your score, you need to kill all enemies with a minimum number of bullets. debian/changelog0000644000000000000000000003003611714476457011062 0ustar xsoldier (1:1.8-2) unstable; urgency=low * debian/rules: set ./configure options with dpkg-buildflags --export=configure * debian/control: added Build-Depends: dpkg-dev (>= 1.16.1) because this package uses dpkg-buildflags * debian/patches/bad-sprintf.diff: new file, fixes insecure sprintf() in manage.c * debian/patches/array-size-calculation.diff: new file, replaces sizeof(array) with sizeof(array)/sizeof(array[0]) when the program calculates the size of the array -- Oohara Yuuma Wed, 08 Feb 2012 22:01:40 +0900 xsoldier (1:1.8-1) unstable; urgency=low * New upstream release * debian/rules, debian/README.Debian: disabled the joystick support because it is Linux specific and not maintained (closes: #636808) * debian/rules: removed the useless chmod at the end of the build * debian/source/format: new file, set the source format to 3.0 (quilt) * debian/control, debian/rules: don't copy config.guess and config.sub from autotools-dev because they are unnecessary * debian/control, debian/compat: set debhelper compatibility level to 8 * debian/control, debian/rules: use dh-autoreconf to regenerate autoconf/automake files * debian/control: added Build-Conflicts: autoconf2.13, automake1.4 just in case * debian/postinst: use /bin/sh because this script does not depend on bash * debian/postinst, debian/postrm: quoted exclamation marks just in case * debian/rules: added build-arch and build-indep targets * debian/control: set Standards-Version: to 3.9.2 -- Oohara Yuuma Sat, 20 Aug 2011 16:23:26 +0900 xsoldier (1:1.5-2) unstable; urgency=low * debian/control, debian/rules: Build-Depends: on autotools-dev because the package uses autoconf -- Oohara Yuuma Fri, 13 Nov 2009 04:43:33 +0900 xsoldier (1:1.5-1) unstable; urgency=low * acknowledged NMU except for the following change: + debian/postrm: Remove /var/games only if it is not in the control of dpkg. Don't remove /var even if it is empty. * new upstream release * new upstream release fixes the following bug: + make sure that an object never acts at the same frame as it is created (Closes: #171581) * new maintainer (Closes: #554262) * debian/changelog: added the "Old Changelog:" to the entry of version 1:0.96-8.1 because its date is missing * debian/control: uses Homepage: for the upstream URL * debian/control: avoids to use the word "I" to satisfy lintian * debian/xsoldier.doc-base: set Section: to Games/Action * debian/compat: set debhelper compatibility level to 7 * debian/control: updated versioned dependency on debhelper * debian/rules: replaced dh_clean -k with dh_prep * debian/prerm: removed because it does nothing * debian/control: set Standards-Version: to 3.8.3 * debian/copyright: refers to /usr/share/common-licenses/GPL-2 rather than /usr/share/common-licenses/GPL because its license is "GPL version 2 or later" * -- Oohara Yuuma Wed, 11 Nov 2009 21:19:09 +0900 xsoldier (1:1.4-1.1) unstable; urgency=low * Non-maintainer upload. * debian/watch: Added. * debian/rules: + Remove DH_COMPAT, now in debian/compat and level 4 + Replaced deprecated chown call + Pass CFLAGS and LDFLAGS to configure script * Fix bashism in preinst (Closes: #475635) * debian/postrm: also remove /var/games (if empty) on purge (Closes: #333281) * debian/control: + Bump versioned debhelper version to 4 + x-dev -> x11proto-core-dev + Remove versioned dependency on libsdl-image1.2-dev, satisfied in sarge + Added ${misc:Depends} * debian/menu: updated to new menu sections policy -- Raphael Geissert Tue, 01 Jul 2008 15:10:20 -0500 xsoldier (1:1.4-1) unstable; urgency=low * New upstream release * acknowledged NMU (xlibs-dev transition) (closes: #346763) * debian/control: removed automake1.7 and autoconf because they are not necessary * the SDL version of the new upstream release quits if a TERM signal is received or if the window is closed (closes: #386181) -- Oohara Yuuma Sat, 16 Sep 2006 18:36:54 +0900 xsoldier (1:1.3-5.1) unstable; urgency=low * Non-maintainer upload for xlibs-dev transition. * debian/control: Replace build-dep on xlibs-dev (Closes: #346763) -- Marc 'HE' Brockschmidt Thu, 19 Jan 2006 16:39:55 +0100 xsoldier (1:1.3-5) unstable; urgency=low * debian/xsoldier.xpm: new file, created from pixmap/Boss5.xpm with the folloing imagemagick command: mogrify -format xpm -geometry 32x32 -map \ /usr/X11R6/include/X11/pixmaps/cmap.xpm xsoldier.xpm Thanks to Mark Purcell for suggestion. (closes: #273454) * debian/xsoldier.menu: added an icon -- Oohara Yuuma Sat, 2 Oct 2004 13:22:09 +0900 xsoldier (1:1.3-4) unstable; urgency=low * acknowledged NMU which fixed Build-Depends: (closes: #240160) * debian/control: s/automake1.6/automake1.7/ in Build-Depends: -- Oohara Yuuma Mon, 19 Apr 2004 11:45:26 +0900 xsoldier (1:1.3-3.1) unstable; urgency=low * added missing build dependency on xlibs-dev -- Alexander Schmehl Sun, 18 Apr 2004 03:49:16 +0200 xsoldier (1:1.3-3) unstable; urgency=low * debian/control: build with new libsdl-image1.2-dev (which uses libpng3) and automake1.6 -- Oohara Yuuma Mon, 22 Jul 2002 02:32:58 +0900 xsoldier (1:1.3-2) unstable; urgency=low * debian/postinst, debian/prerm: use /bin/bash as the interpreter because the dh_installdocs section uses command -v -- Oohara Yuuma Wed, 19 Jun 2002 01:59:53 +0900 xsoldier (1:1.3-1) unstable; urgency=low * new upstream release -- Oohara Yuuma Sun, 26 May 2002 18:03:43 +0900 xsoldier (1:1.2-3) unstable; urgency=low * image.c: fixed image loading so that xsoldier displays the correct color on a non-24-bit-per-pixel display (thanks to Stephen McCamant for the patch) (closes: #145842) * debian/control: removed unnecessary paragraph from Description: * debian/control: added version condition to Build-Depends: autoconf because configure.ac uses AC_PREREQ * README: fixed typo -- Oohara Yuuma Sun, 5 May 2002 14:00:48 +0900 xsoldier (1:1.2-2) unstable; urgency=low * configure.ac: does not stop configuring even if --with-sdl is specified but AC_CHECK_LIB([SDL], [SDL_Init]) failed (this won't do any harm because if there is no SDL then "make" will fail correctly) (I don't know why AC_CHECK_LIB fails on a non-i386 architecture (perhaps missing -lpthread?)) (closes: #144926) * configure: regenerated * debian/control: added automake and autoconf to Build-Depends: just in case -- Oohara Yuuma Mon, 29 Apr 2002 10:51:12 +0900 xsoldier (1:1.2-1) unstable; urgency=low * new maintainer * new upstream release, with new upstream developer (closes: #142548) * new upstream release fixed the following bugs: - crashing into boss 6 did not destroy the player's ship after the boss teleported (closes: #142543) - the background of the title scrolled at a wrong speed when you quited when "stage cleared" message was displayed (closes: #142544) - joystick patch available at the original author's webpage was not applied (closes: #142545) - damage calculation of weapon 3 was wrong (closes: #142546) - EnemyLaserAct() sometimes fell off without calling return, causing suicide of boss enemies (closes: #142550) * packaging SDL version on RFP (closes: #144259) * Splitting a package is a last resort, so let's package only SDL version and see how users complain. Once a package is split, merging it is much harder than splitting. If you don't want to install SDL, grab the source code and compile the raw X version by yourself. * Moving files to follow the FHS: - image data are now in /usr/share, not in /usr/lib (closes: #142547) - the score file is now in /var/games/xsoldier/, not in /var/lib/games * The default score file is in /usr/share, not in /var (closes: #142549) * If you are upgrading from 1:0.96-14 or older, I don't save the old score file because: - there is no easy way to do so (since the location of the score file is changed, there is no secure temporal directory for it during an upgrade) - the score file is not compatible in a gamer's view (it uses the same format but the score was inflated) * added doc-base support * debian/copyright: reflected the new upstream * debian/override: removed because lintian knows about setgid games * debian/README.Debian: new file, explaining score file handling -- Oohara Yuuma Sun, 28 Apr 2002 23:01:55 +0900 xsoldier (1:0.96-14) unstable; urgency=low * "q" now quits even if the game isn't paused (closes: #117501) * add manpage thanks to Uwe Hermann (closes: #117250, #88312) -- Adrian Bridgett Sun, 2 Dec 2001 14:41:35 +0000 xsoldier (1:0.96-13) unstable; urgency=low * add Build-Depends, removed dh_suidregister call (closes: #80879, #84658) -- Adrian Bridgett Sat, 3 Mar 2001 15:05:10 +0000 xsoldier (1:0.96-12) unstable; urgency=high * if paused now says game will be resumed, not restarted (closes: #81246) * removed brace expansion from debian/rules (closes: #81276) -- Adrian Bridgett Sun, 4 Feb 2001 18:13:05 +0000 xsoldier (1:0.96-11) unstable; urgency=high * fix GPL location * add lintian override for executable permissions -- Adrian Bridgett Sat, 23 Dec 2000 18:22:07 +0000 xsoldier (1:0.96-10) unstable; urgency=high * use correct fix from Jim Studt . Doh! * added Jim's entry into changelog. This upload needed to stop my out-by-one fix overriding Jim's -- Adrian Bridgett Mon, 20 Dec 1999 18:28:37 +0000 xsoldier (1:0.96-9) unstable; urgency=high * security fix (closes #52962). Thanks to Wichert Akkerman for forwarding this from Brock Tellier. * FHS -- Adrian Bridgett Sun, 19 Dec 1999 20:07:46 +0000 Old Changelog: xsoldier (1:0.96-8.1) unstable; urgency=low * fix several strcpy related overflows (closes 52962) * adjust debian/rules for /usr/share/doc * alter debian/rules so 'clean' target works on fresh source -- Jim Studt xsoldier (1:0.96-8) unstable; urgency=low * add author's name to copyright (closes 30860) * menu-item-uses-icon-none fix -- Adrian Bridgett Sun, 20 Dec 1998 15:25:36 +0000 xsoldier (1:0.96-7) unstable; urgency=low * don't build using /usr/games (closes 25054) * stop using dh_installdebfiles (deprecated debhelper command) -- Adrian Bridgett Mon, 31 Aug 1998 22:26:31 +0100 xsoldier (1:0.96-6) unstable; urgency=low * handle high-score file correctly (it is now no longer a conffile) * move (undocumented) manpage to /usr/man/man6 -- Adrian Bridgett Sun, 1 Mar 1998 19:46:15 +0000 xsoldier (1:0.96-5) unstable; urgency=low * fixes for lintian: * added link to undocumented manpage * now refers to uncompressed GPL * .xpm files installed rw-r--r-- -- Adrian Bridgett Thu, 12 Feb 1998 20:26:44 +0000 xsoldier (1:0.96-4) unstable; urgency=low * moved from x11 section to games -- Adrian Bridgett Tue, 14 Oct 1997 18:44:48 +0000 xsoldier (0.96-3) unstable; urgency=low * compiled with xlib6g and xpm4g [#12708,#12964] * now uses debhelper -- Adrian Bridgett Sun, 14 Sep 1997 18:04:59 +0000 xsoldier (0.96-2) unstable; urgency=low * copyright file now contains source and license details -- Adrian Bridgett Thu, 21 Aug 1997 15:20:46 +0100 xsoldier (0.96-1) unstable; urgency=low * Initial Release. -- Adrian Bridgett Tue, 1 Jul 1997 16:05:37 +0100 debian/compat0000644000000000000000000000000211622732771010374 0ustar 8 debian/README.Debian0000644000000000000000000000154411621753440011236 0ustar xsoldier for Debian ------------------- The joystick support is disabled because it is Linux specific (it directly reads /dev/js0) and not maintained. -- Oohara Yuuma , Sun, 14 Aug 2011 23:09:36 +0900 If you are upgrading from 1:0.96-14 or older, the old score file (/var/lib/games/xsoldier.scores) will be removed and the default score file will be copied to /var/games/xsoldier/xsoldier.scores . The change of its location is necessary to follow the FHS. I don't save the old score file partly because there is no easy way to do so (since the location of the score file is changed, there is no secure temporal directory for it during an upgrade) and partly because the score file is not compatible in a gamer's view (it uses the same format but the score was inflated). -- Oohara Yuuma , Sat, 27 Apr 2002 13:28:22 +0900 debian/xsoldier.doc-base0000644000000000000000000000036011621752540012420 0ustar Document: xsoldier Title: xsoldier README Author: Oohara Yuuma Abstract: This document describes the xsoldier game (command line options, key control and so on). Section: Games/Action Format: text Files: /usr/share/doc/xsoldier/README.gz debian/postrm0000644000000000000000000000251211623670114010436 0ustar #! /bin/sh # postrm script for xsoldier # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `purge' # * `upgrade' # * `failed-upgrade' # * `abort-install' # * `abort-install' # * `abort-upgrade' # * `disappear' overwrit>r> # for details, see /usr/share/doc/packaging-manual/ case "$1" in purge) # remove the score file if test -e /var/games/xsoldier/xsoldier.scores then rm /var/games/xsoldier/xsoldier.scores fi if test -d /var/games/xsoldier/ then rmdir /var/games/xsoldier/ || true # remove /var/games if it is not in the control of dpkg if '!' dpkg -S /var/games > /dev/null 2>&1 then rmdir /var/games/ || true fi fi ;; remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 0 esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# debian/preinst0000644000000000000000000000215711621752540010605 0ustar #! /bin/sh # preinst script for xsoldier # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `install' # * `install' # * `upgrade' # * `abort-upgrade' # # For details see /usr/share/doc/packaging-manual/ case "$1" in install|upgrade) # in xsoldier 1:0.96-14 or older, the score file was # /var/lib/games/xsoldier.scores and it was handled by xsoldier maintainer # scripts. Since the location of the score file is changed, we need to # remove the old score file here (unfortunately, there is no easy way to # save or copy it). if test -f /var/lib/games/xsoldier.scores then rm /var/lib/games/xsoldier.scores fi if test -d /var/lib/games/ then rmdir /var/lib/games/ > /dev/null 2>&1|| true fi ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 debian/rules0000755000000000000000000000544411714464571010267 0ustar #!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) CONFFLAGS = ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) CONFFLAGS += --build $(DEB_HOST_GNU_TYPE) else CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) endif configure: configure-stamp configure-stamp: dh_testdir [ ! -e config.cache ] || rm config.cache # Once dh_autoreconf is called, dh_autoreconf_clean must be called # before dh_autoreconf is called again, or information saved in # debian/autoreconf.before will be lost. Since dh_autoreconf_clean # can be called more than once without a problem, call it here. dh_autoreconf_clean dh_autoreconf # Add here commands to configure the package. ./configure $(shell dpkg-buildflags --export=configure) \ $(CONFFLAGS) \ --prefix=/usr --bindir=/usr/games \ --localstatedir=/var --mandir=/usr/share/man \ --with-sdl --disable-joystick touch configure-stamp build: build-arch build-indep build-arch: build-arch-stamp build-arch-stamp: configure-stamp dh_testdir # Add here commands to compile the package. $(MAKE) touch build-arch-stamp build-indep: # We have nothing to do. clean: dh_testdir dh_testroot rm -f build-arch-stamp configure-stamp # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) distclean # dh_autoreconf_clean must be called after $(MAKE) distclean # because dh_autoreconf_clean removes files $(MAKE) distclean depends on dh_autoreconf_clean dh_clean config.cache install: build dh_testdir dh_testroot dh_prep dh_installdirs # Add here commands to install the package into debian/xsoldier. $(MAKE) install DESTDIR=$(CURDIR)/debian/xsoldier # Debian-specific icon file install -m 644 debian/xsoldier.xpm \ $(CURDIR)/debian/xsoldier/usr/share/games/xsoldier/ # the score file is handled by maintainer scripts, so move it here cp $(CURDIR)/debian/xsoldier/var/games/xsoldier/xsoldier.scores \ $(CURDIR)/debian/xsoldier/usr/share/games/xsoldier/xsoldier.scores rm -r $(CURDIR)/debian/xsoldier/var/ # Build architecture-independent files here. binary-indep: build install # We have nothing to do. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installdocs README dh_installmenu dh_installman dh_installchangelogs ChangeLog dh_link dh_strip dh_compress dh_fixperms chown root:games $(CURDIR)/debian/xsoldier/usr/games/xsoldier chmod 2755 $(CURDIR)/debian/xsoldier/usr/games/xsoldier dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build build-arch build-indep clean binary binary-arch binary-indep install configure debian/patches/0000755000000000000000000000000011714476466010635 5ustar debian/patches/series0000644000000000000000000000005511714470752012042 0ustar bad-sprintf.diff array-size-calculation.diff debian/patches/bad-sprintf.diff0000644000000000000000000000104711714467130013666 0ustar Description: fixes insecure sprintf() This patch replaces sprintf(to, from) with strcpy(to, from). Using sprintf() in this way is dangerous because the string "from" may include conversion specifications such as "%s". Author: Oohara Yuuma Last-Update: 2012-02-08 --- a/manage.c +++ b/manage.c @@ -394,7 +394,7 @@ New = (PlayerData *)malloc(sizeof(PlayerData)); - sprintf(New->Rec[0].name,name); + strcpy(New->Rec[0].name,name); New->Rec[0].score = 0; New->Rec[0].stage = 0; New->Rec[0].loop = 0; debian/patches/array-size-calculation.diff0000644000000000000000000001107211714476242016042 0ustar Description: fixes possibly wrong array size calculation with sizeof() This patch replaces sizeof(array) with sizeof(array)/sizeof(array[0]) when the program calculates the size of the array. Although all arrays handled in this way are arrays of char, there may be an architecture where sizeof(char) is not 1. Author: Oohara Yuuma Last-Update: 2012-02-08 --- a/main.c +++ b/main.c @@ -160,7 +160,7 @@ else argv0 = argv[0]; /* copy command name */ - strncpy(command,argv0, sizeof(command)-1); + strncpy(command,argv0, sizeof(command)/sizeof(command[0]) - 1); for (i=1; ipw_name,sizeof(name)); - name[sizeof(name)-1]= '\0'; + strncpy(name,pw->pw_name,sizeof(name)/sizeof(name[0])); + name[sizeof(name)/sizeof(name[0]) - 1]= '\0'; /* check if the player name consists of only printable chars */ - for (i = 0; (i <= sizeof(name) - 1) && (name[i] != '\0'); i++) + for (i = 0; (i <= sizeof(name)/sizeof(name[0]) - 1) && (name[i] != '\0'); i++) if (!isprint(name[i])) { fprintf(stderr, "warning: non-printable char found in your name, " --- a/score.c +++ b/score.c @@ -73,7 +73,7 @@ rec[i].loop = loop; rec[i].stage = stage; /* check if the player name consists of only printable chars */ - for (j = 0; (j <= sizeof(name) - 1) && (name[j] != '\0'); j++) + for (j = 0; (j <= sizeof(name)/sizeof(name[0]) - 1) && (name[j] != '\0'); j++) if (!isprint(name[j])) { fprintf(stderr, "warning: non-printable char found in the name of " @@ -82,7 +82,7 @@ name[j] = '?'; } - strncpy(rec[i].name, name, sizeof(rec[i].name)); + strncpy(rec[i].name, name, sizeof(rec[i].name)/sizeof(rec[i].name[0])); #ifdef DEBUG fprintf(stderr, "entry %d read: %d %d %d %s\n", i + 1, rec[i].score, rec[i].loop, rec[i].stage, rec[i].name); @@ -153,9 +153,9 @@ */ for (i = 1; i <= 10; i++) { - temp = sizeof(p->Rec[0].name); - if (temp > sizeof(p->Rec[i].name)) - temp = sizeof(p->Rec[i].name); + temp = sizeof(p->Rec[0].name)/sizeof(p->Rec[0].name[0]); + if (temp > sizeof(p->Rec[i].name)/sizeof(p->Rec[i].name[0])) + temp = sizeof(p->Rec[i].name)/sizeof(p->Rec[i].name[0]); if (strncmp(p->Rec[0].name, p->Rec[i].name, temp) == 0) { del = i; @@ -193,7 +193,7 @@ p->Rec[i].score = p->Rec[i - 1].score; p->Rec[i].loop = p->Rec[i - 1].loop; p->Rec[i].stage = p->Rec[i - 1].stage; - strncpy(p->Rec[i].name, p->Rec[i - 1].name, sizeof(p->Rec[i].name)); + strncpy(p->Rec[i].name, p->Rec[i - 1].name, sizeof(p->Rec[i].name)/sizeof(p->Rec[i].name[0])); } #ifdef DEBUG printf("rank[%d] <- rank[0]\n", rank); @@ -203,7 +203,7 @@ p->Rec[rank].score = p->Rec[0].score; p->Rec[rank].loop = p->Rec[0].loop; p->Rec[rank].stage = p->Rec[0].stage; - strncpy(p->Rec[rank].name, p->Rec[0].name, sizeof(p->Rec[rank].name)); + strncpy(p->Rec[rank].name, p->Rec[0].name, sizeof(p->Rec[rank].name)/sizeof(p->Rec[rank].name[0])); return rank; } @@ -258,7 +258,7 @@ if (rec[n].loop < 1) rec[n].loop = 1; rec[n].stage = rand() % 8 + 1; - snprintf(rec[n].name, sizeof(rec[n].name) - 1, "(unknown)"); + snprintf(rec[n].name, sizeof(rec[n].name)/sizeof(rec[n].name[0]) - 1, "(unknown)"); } static void copy_Record_to_PlayerData(Record *rec, PlayerData *p) debian/source/0000755000000000000000000000000011622730320010462 5ustar debian/source/format0000644000000000000000000000001411622730320011670 0ustar 3.0 (quilt)