It's probably unnecessary, but better be safe than sorry.
Signed-off-by: Karel Zak <kzak@redhat.com>
const struct menu *menu;
int key, rc;
const char *prompt;
- char buf[BUFSIZ];
+ char buf[BUFSIZ] = { '\0' };
if (fdisk_is_details(cxt))
prompt = _("Expert command (m for help): ");
void *data __attribute__((__unused__)))
{
int rc = 0;
- char buf[BUFSIZ];
+ char buf[BUFSIZ] = { '\0' };
assert(cxt);
assert(ask);
_("Hex code (type L to list all codes): ") :
_("Partition type (type L to list all types): ");
do {
- char buf[256];
+ char buf[256] = { '\0' };
int rc = get_user_reply(q, buf, sizeof(buf));
if (rc) {
p = readline(prompt);
if (!p)
return 1;
- strncpy(buf, p, bufsz);
+ strncpy(buf, p, bufsz - 1);
if (bufsz != 0)
buf[bufsz - 1] = '\0';
free(p);
break;
case FDISK_ASKTYPE_YESNO:
{
- char buf[BUFSIZ];
+ char buf[BUFSIZ] = { '\0' };
fputc('\n', stdout);
do {
int x;