Skip to content
Permalink
Browse files

Have to NUL-terminate A

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 f02eb4ec212dcd3609879e9a9b34e03aea1d6896
Showing with 1 addition and 1 deletion.
  1. +1 −1 qr1-foregone.c
@@ -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')

0 comments on commit f02eb4e

Please sign in to comment.
You can’t perform that action at this time.