[misc] fix PVS-Studio warnings

This commit is contained in:
Pete Batard 2022-01-05 12:57:26 +01:00
parent eeca1f279c
commit c28f9bc491
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
26 changed files with 98 additions and 81 deletions

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Extract icon from executable and set autorun.inf
* Copyright © 2012-2019 Pete Batard <pete@akeo.ie>
* Copyright © 2012-2021 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -26,6 +26,7 @@
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "rufus.h"
#include "missing.h"
@ -185,7 +186,8 @@ BOOL SetAutorun(const char* path)
uprintf("Created: %s", filename);
// .inf -> .ico
filename[strlen(filename)-1] = 'o';
filename[strlen(filename)-2] = 'c';
assert(strlen(filename) >= 2);
filename[strlen(filename) - 1] = 'o';
filename[strlen(filename) - 2] = 'c';
return ExtractAppIcon(filename, FALSE);
}