Skip to content

Commit

Permalink
Have to NUL-terminate A
Browse files Browse the repository at this point in the history
Who'd have thought...

Alternatively, I guess I could/should have increased the strncpy()
limit from MAXDIGITS to MAXDIGITS+1.

https://twitter.com/codinghorror/status/506010907021828096
  • Loading branch information
sleinen committed Apr 7, 2019
1 parent 31a3537 commit f02eb4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion qr1-foregone.c
Expand Up @@ -26,7 +26,7 @@ main ()
start = -1;
strncpy (A, N, MAXDIGITS);
memset (B, '0', MAXDIGITS);
B[l] = 0;
A[l] = B[l] = 0;
for (i = 0; i < l; ++i)
{
if (N[i] == '4')
Expand Down

0 comments on commit f02eb4e

Please sign in to comment.