Skip to content

Commit

Permalink
fix warning strcpy and DES
Browse files Browse the repository at this point in the history
  • Loading branch information
pox822 committed Jan 14, 2024
1 parent e13d373 commit 96b68f0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
Empty file added ChangeLog
Empty file.
Empty file added NEWS
Empty file.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ terminal, will display the two bytes of data starting with byte 6.
Building mfterm
---------------

Standard: ./configure; make; make install
Standard: ./autogen.sh; ./configure; make; make install

See INSTALL file for details.

Expand Down
6 changes: 6 additions & 0 deletions mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,19 @@ int compute_mac(const unsigned char* input,

// Generate a key schedule. Don't be picky, allow bad keys.
DES_key_schedule schedule;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
DES_set_key_unchecked(&des_key, &schedule);
#pragma GCC diagnostic pop

// IV is all zeroes
unsigned char ivec[] = { 0, 0, 0, 0, 0, 0, 0, 0 };

// Compute the DES in CBC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
DES_ncbc_encrypt(padded_input, output, length, &schedule, &ivec, 1);
#pragma GCC diagnostic pop

// Move up and truncate (we only want 8 bytes)
for (int i = 0; i < 8; ++i)
Expand Down
3 changes: 3 additions & 0 deletions mfterm.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ char* completion_sub_cmd_generator(const char* text, int state) {

// Extract command and sub-command
char buff[128];
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(buff, name, sizeof(buff));
#pragma GCC diagnostic pop
char* cmd = strtok(buff, " ");
char* sub = strtok(NULL, " ");

Expand Down

0 comments on commit 96b68f0

Please sign in to comment.