• R/O
  • SSH
  • HTTPS

gpx2shp: Commit


Commit MetaInfo

Revisión10 (tree)
Tiempo2013-07-05 01:09:21
Autorpagong

Log Message

* Modified strcpy to strncpy to avoid buffer overflow in some cases.

Cambiar Resumen

Diferencia incremental

--- trunk/gpx2shp/configure (revision 9)
+++ trunk/gpx2shp/configure (revision 10)
@@ -1,6 +1,6 @@
11 #! /bin/sh
22 # Guess values for system-dependent variables and create Makefiles.
3-# Generated by GNU Autoconf 2.69 for gpx2shp 0.69.
3+# Generated by GNU Autoconf 2.69 for gpx2shp 0.70.
44 #
55 # Report bugs to <hiraoka @at@ azukimap.jp>.
66 #
@@ -580,8 +580,8 @@
580580 # Identity of this package.
581581 PACKAGE_NAME='gpx2shp'
582582 PACKAGE_TARNAME='gpx2shp'
583-PACKAGE_VERSION='0.69'
584-PACKAGE_STRING='gpx2shp 0.69'
583+PACKAGE_VERSION='0.70'
584+PACKAGE_STRING='gpx2shp 0.70'
585585 PACKAGE_BUGREPORT='hiraoka @at@ azukimap.jp'
586586 PACKAGE_URL=''
587587
@@ -1259,7 +1259,7 @@
12591259 # Omit some internal or obsolete options to make the list less imposing.
12601260 # This message is too long to be a string in the A/UX 3.1 sh.
12611261 cat <<_ACEOF
1262-\`configure' configures gpx2shp 0.69 to adapt to many kinds of systems.
1262+\`configure' configures gpx2shp 0.70 to adapt to many kinds of systems.
12631263
12641264 Usage: $0 [OPTION]... [VAR=VALUE]...
12651265
@@ -1325,7 +1325,7 @@
13251325
13261326 if test -n "$ac_init_help"; then
13271327 case $ac_init_help in
1328- short | recursive ) echo "Configuration of gpx2shp 0.69:";;
1328+ short | recursive ) echo "Configuration of gpx2shp 0.70:";;
13291329 esac
13301330 cat <<\_ACEOF
13311331
@@ -1413,7 +1413,7 @@
14131413 test -n "$ac_init_help" && exit $ac_status
14141414 if $ac_init_version; then
14151415 cat <<\_ACEOF
1416-gpx2shp configure 0.69
1416+gpx2shp configure 0.70
14171417 generated by GNU Autoconf 2.69
14181418
14191419 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1782,7 +1782,7 @@
17821782 This file contains any messages produced by compilers while
17831783 running configure, to aid debugging if configure makes a mistake.
17841784
1785-It was created by gpx2shp $as_me 0.69, which was
1785+It was created by gpx2shp $as_me 0.70, which was
17861786 generated by GNU Autoconf 2.69. Invocation command line was
17871787
17881788 $ $0 $@
@@ -5237,7 +5237,7 @@
52375237 # report actual input values of CONFIG_FILES etc. instead of their
52385238 # values after options handling.
52395239 ac_log="
5240-This file was extended by gpx2shp $as_me 0.69, which was
5240+This file was extended by gpx2shp $as_me 0.70, which was
52415241 generated by GNU Autoconf 2.69. Invocation command line was
52425242
52435243 CONFIG_FILES = $CONFIG_FILES
@@ -5303,7 +5303,7 @@
53035303 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
53045304 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
53055305 ac_cs_version="\\
5306-gpx2shp config.status 0.69
5306+gpx2shp config.status 0.70
53075307 configured by $0, generated by GNU Autoconf 2.69,
53085308 with options \\"\$ac_cs_config\\"
53095309
--- trunk/gpx2shp/src/setpath.c (revision 9)
+++ trunk/gpx2shp/src/setpath.c (revision 10)
@@ -134,13 +134,13 @@
134134 * initialize a path attribute
135135 */
136136 void initPathAttr(pathattr * pattr, g2sattr * attr) {
137- strcpy(pattr->name, attr->name);
138- strcpy(pattr->cmt, attr->cmt);
139- strcpy(pattr->desc, attr->desc);
140- strcpy(pattr->src, attr->src);
141- strcpy(pattr->link, attr->link);
137+ strncpy(pattr->name, attr->name, NAMELENGTH);
138+ strncpy(pattr->cmt, attr->cmt, COMMENTLENGTH);
139+ strncpy(pattr->desc, attr->desc, COMMENTLENGTH);
140+ strncpy(pattr->src, attr->src, COMMENTLENGTH);
141+ strncpy(pattr->link, attr->link, FILENAMELENGTH);
142142 pattr->number = attr->number;
143- strcpy(pattr->type, attr->type);
143+ strncpy(pattr->type, attr->type, TYPELENGTH);
144144 pattr->length = 0;
145145 pattr->interval = 0;
146146 pattr->speed = 0;
@@ -309,12 +309,12 @@
309309 double leng = 0;
310310 double spd;
311311 if (pattr->count == 1) {
312- strcpy(_t, attr->time);
312+ strncpy(_t, attr->time, TIMELENGTH);
313313 } else {
314314 /* time interval */
315315 intvl = getTimeInterval(_t, attr->time);
316316 pattr->interval = pattr->interval + intvl;
317- strcpy(_t, attr->time);
317+ strncpy(_t, attr->time, TIMELENGTH);
318318 /* length interval */
319319 leng = getDistance(_x, _y, attr->lon, attr->lat);
320320 pattr->length = pattr->length + leng;
--- trunk/gpx2shp/src/config.h.in (revision 9)
+++ trunk/gpx2shp/src/config.h.in (revision 10)
@@ -74,6 +74,9 @@
7474 /* Define to the one symbol short name of this package. */
7575 #undef PACKAGE_TARNAME
7676
77+/* Define to the home page for this package. */
78+#undef PACKAGE_URL
79+
7780 /* Define to the version of this package. */
7881 #undef PACKAGE_VERSION
7982
--- trunk/gpx2shp/src/main.c (revision 9)
+++ trunk/gpx2shp/src/main.c (revision 10)
@@ -21,7 +21,7 @@
2121 * Shows a usage message
2222 */
2323 void usage(char **argv) {
24- fprintf(stdout, "Usage: %s gpxfile [options] [-o output basename]\n",
24+ fprintf(stdout, "Usage: %s [options] [-o output basename] gpxfile\n",
2525 argv[0]);
2626 fprintf(stdout,
2727 "-o, --output Sets output basename. The default is (source file\n");
--- trunk/gpx2shp/src/elementControl.c (revision 9)
+++ trunk/gpx2shp/src/elementControl.c (revision 10)
@@ -34,7 +34,7 @@
3434 pdata->attr->maxlat = atof(attr[i + 1]);
3535 }
3636 if (!strcmp(attr[i], "author")) {
37- strcpy(pdata->attr->author, attr[i + 1]);
37+ strncpy(pdata->attr->author, attr[i + 1], NAMELENGTH);
3838 }
3939 }
4040 if (pdata->prop->parseTrk) {
@@ -82,26 +82,26 @@
8282 static int isFirstRteAsPoint = 1;
8383 /* common elements */
8484 if (!strcmp(element, "name")) {
85- strcpy(pdata->attr->name, pdata->databuf);
85+ strncpy(pdata->attr->name, pdata->databuf, NAMELENGTH);
8686 }
8787 if (!strcmp(element, "cmt")) {
88- strcpy(pdata->attr->cmt, pdata->databuf);
88+ strncpy(pdata->attr->cmt, pdata->databuf, COMMENTLENGTH);
8989 }
9090 if (!strcmp(element, "desc")) {
91- strcpy(pdata->attr->desc, pdata->databuf);
91+ strncpy(pdata->attr->desc, pdata->databuf, COMMENTLENGTH);
9292 }
9393 if (!strcmp(element, "src")) {
94- strcpy(pdata->attr->src, pdata->databuf);
94+ strncpy(pdata->attr->src, pdata->databuf, COMMENTLENGTH);
9595 }
9696 if (!strcmp(element, "link")) {
97- strcpy(pdata->attr->link, pdata->databuf);
97+ strncpy(pdata->attr->link, pdata->databuf, FILENAMELENGTH);
9898 }
9999 if (!strcmp(element, "type")) {
100- strcpy(pdata->attr->type, pdata->databuf);
100+ strncpy(pdata->attr->type, pdata->databuf, TYPELENGTH);
101101 }
102102 /* waypoint and metadata elements */
103103 if (!strcmp(element, "time")) {
104- strcpy(pdata->attr->time, pdata->databuf);
104+ strncpy(pdata->attr->time, pdata->databuf, TIMELENGTH);
105105 }
106106 /* route and track point elements */
107107 if (!strcmp(element, "number")) {
@@ -118,10 +118,10 @@
118118 pdata->attr->geoidheight = atof(pdata->databuf);
119119 }
120120 if (!strcmp(element, "sym")) {
121- strcpy(pdata->attr->sym, pdata->databuf);
121+ strncpy(pdata->attr->sym, pdata->databuf, NAMELENGTH);
122122 }
123123 if (!strcmp(element, "fix")) {
124- strcpy(pdata->attr->fix, pdata->databuf);
124+ strncpy(pdata->attr->fix, pdata->databuf, NAMELENGTH);
125125 }
126126 if (!strcmp(element, "sat")) {
127127 pdata->attr->sat = atoi(pdata->databuf);
@@ -140,19 +140,19 @@
140140 }
141141 /* metadata elements */
142142 if (!strcmp(element, "author")) {
143- strcpy(pdata->attr->author, pdata->databuf);
143+ strncpy(pdata->attr->author, pdata->databuf, NAMELENGTH);
144144 }
145145 if (!strcmp(element, "keywords")) {
146- strcpy(pdata->attr->keywords, pdata->databuf);
146+ strncpy(pdata->attr->keywords, pdata->databuf, NAMELENGTH);
147147 }
148148 if (!strcmp(element, "copyright")) {
149- strcpy(pdata->attr->copyright, pdata->databuf);
149+ strncpy(pdata->attr->copyright, pdata->databuf, NAMELENGTH);
150150 }
151151 if (!strcmp(element, "year")) {
152152 pdata->attr->year = atoi(pdata->databuf);
153153 }
154154 if (!strcmp(element, "license")) {
155- strcpy(pdata->attr->license, pdata->databuf);
155+ strncpy(pdata->attr->license, pdata->databuf, NAMELENGTH);
156156 }
157157 if (!strcmp(element, "bounds")) {
158158 /* none */
Show on old repository browser