Skip to contentSkip to conversation

sparc64: aout32_core_dump(): convert strncpy(x, y, sizeof(x)) to strlcpy

PATCH New Roel Kluin 1 participant 1 message Mar 6, 2008 exec and binfmt

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 sparc64: aout32_core_dump(): convert strncpy(x, y, sizeof(x)) to strlcpy

This patch was not yet tested. Please confirm it's right.
---
strncpy does not append '\0' if the length of the source string equals the size parameter, strlcpy does.

---

arch/sparc64/kernel/binfmt_aout32.c +1 -1
index 9877f2d..0a63d18 100644
@@ -100,7 +100,7 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file,
 	set_fs(KERNEL_DS);
 	has_dumped = 1;
 	current->flags |= PF_DUMPCORE;
-       	strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm));
+	strlcpy(dump.u_comm, current->comm, sizeof(dump.u_comm));
 	dump.signal = signr;
 	aout_dump_thread(regs, &dump);