Skip to content

Commit

Permalink
Avoid strcpy of overlapping strings.
Browse files Browse the repository at this point in the history
The source and destination for strcpy must not overlap, and failure to
ensure that's true causes a crash on OS X. memmove does not have such a
restriction.
  • Loading branch information
QuLogic committed Oct 14, 2015
1 parent 6eabf3c commit e83516a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rtodms.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ rtodms(char *s, double r, int pos, int neg) {
if (*p != '.')
++p;
if (++q != p)
(void)strcpy(p, q);
(void)memmove(p, q, (sign ? 3 : 2));
} else if (min)
(void)sprintf(ss,"%dd%d'%c",deg,min,sign);
else
Expand Down

0 comments on commit e83516a

Please sign in to comment.