Index: uspace/app/bdsh/cmds/modules/rm/rm.c
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 81b1db8cec0aa9dbafab33ef24b55b230180a3a7)
+++ uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 41bbab62642e447878bb09ac696779f25d666d92)
@@ -174,5 +174,10 @@
 	memset(buff, 0, sizeof(buff));
 	while ((dp = readdir(dirp))) {
-		snprintf(buff, PATH_MAX - 1, "%s/%s", path, dp->d_name);
+		int len = snprintf(buff, PATH_MAX - 1, "%s/%s", path, dp->d_name);
+		if (len > PATH_MAX-1) {
+			// TODO: Do not enforce arbitrary static limits.
+			cli_error(CL_EFAIL, "Path too long for %s/%s", path, dp->d_name);
+			continue;
+		}
 		scope = rm_scope(buff);
 		switch (scope) {
