Skip to content

Commit de07721

Browse files
Merge pull request martijnvanbrummelen#548 from PartialVolume/Fix_some_strcpy_warnings_for_Debian
Fix some strcpy compiler warnings
2 parents 2fae6ea + 07a7c0a commit de07721

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Process this file with autoconf to produce a configure script.
33

44
AC_PREREQ([2.63])
5-
AC_INIT([nwipe],[0.35],[[email protected]])
5+
AC_INIT([nwipe],[0.35.9],[[email protected]])
66
AM_INIT_AUTOMAKE(foreign subdir-objects)
77
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
88
AC_OUTPUT

man/nwipe.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH NWIPE "24" "October 2023" "nwipe version 0.35" "User Commands"
1+
.TH NWIPE "16" "February 2024" "nwipe version 0.35.9" "User Commands"
22
.SH NAME
33
nwipe \- securely erase disks
44
.SH SYNOPSIS

src/device.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
283283
/* If the serial number hasn't already been populated */
284284
if( next_device->device_serial_no[0] == 0 )
285285
{
286-
strcpy( next_device->device_serial_no, tmp_serial );
286+
strncpy( next_device->device_serial_no, tmp_serial, NWIPE_SERIALNUMBER_LENGTH );
287287
}
288288
}
289289

@@ -292,13 +292,16 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
292292
{
293293
if( next_device->device_serial_no[0] == 0 )
294294
{
295-
strcpy( next_device->device_serial_no, "???????????????" );
295+
strncpy( next_device->device_serial_no, "????????????????????", NWIPE_SERIALNUMBER_LENGTH + 1 );
296296
}
297297
else
298298
{
299-
strcpy( next_device->device_serial_no, "XXXXXXXXXXXXXXX" );
299+
strncpy( next_device->device_serial_no, "XXXXXXXXXXXXXXXXXXXX", NWIPE_SERIALNUMBER_LENGTH + 1 );
300300
}
301301
}
302+
/* strncpy would have copied the null terminator BUT just to be sure, just in case somebody changes the length
303+
* of those strings we should explicitly terminate the string */
304+
next_device->device_serial_no[NWIPE_SERIALNUMBER_LENGTH] = 0;
302305

303306
/* Initialise the variables that toggle the [size][temp c] with [HPA status]
304307
* Not currently used, but may be used in the future or for other purposes

src/version.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
* used by configure to dynamically assign those values
55
* to documentation files.
66
*/
7-
const char* version_string = "0.35.8";
7+
const char* version_string = "0.35.9";
88
const char* program_name = "nwipe";
99
const char* author_name = "Martijn van Brummelen";
1010
const char* email_address = "[email protected]";
11-
const char* years = "2023";
11+
const char* years = "2024";
1212
const char* copyright = "Copyright Darik Horn <[email protected]>\n\
1313
Modifications to original dwipe Copyright Andy Beverley <[email protected]>\n\
1414
This is free software; see the source for copying conditions.\n\
1515
There is NO warranty; not even for MERCHANTABILITY or FITNESS\n\
1616
FOR A PARTICULAR PURPOSE.\n";
17-
const char* banner = "nwipe 0.35.8";
17+
const char* banner = "nwipe 0.35.9";

0 commit comments

Comments
 (0)