IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 31, 2023, 10:55:31 AM (4 years ago)
Author:
eugene
Message:

convert instances of strncpy to strncpy_nowarn (or memcpy in specific cases where ending 0 is not desired)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20220316/Ohana/src/libfits/header/F_print.c

    r42116 r42343  
    7878
    7979found_it:
    80   strncpy (p, string, 80);
     80  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    8181  va_end (argp);
    8282  return (TRUE);
     
    137137    if (!ptr) goto invalid;
    138138    bzero (line, 80);
    139     strncpy (line, ptr, 71);
     139    strncpy_nowarn (line, ptr, 71);
    140140    snprintf (string, 200, "%-8s %-71s", field, line);
    141141  } 
     
    154154  if (!strcmp (mode, "%C")) goto invalid;
    155155
    156   strncpy (p, string, 80);
     156  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    157157 
    158158  va_end (argp);
Note: See TracChangeset for help on using the changeset viewer.